This article includes a list of references, but its sources remain unclear because it has insufficient inline citations. (October 2019) (Learn how and when to remove this template message)
Riley led his crew through the Sahara Desert, after they were shipwrecked off the coast of contemporary Western Sahara in August 1815, and wrote a memoir about their ordeal. This true story describes how they came to be shipwrecked and their travails in the Sahara Desert. The book, published in 1817 and originally titled Authentic Narrative of the Loss of the American Brig 'Commerce' by the "Late Master and Supercargo" James Riley, is modernly republished as Sufferings in Africa.
Lost in this unknown world, Captain Riley felt responsible for his crew and their safety. He told of the events leading to their capture by marauding Sahrawi natives who kept them as slaves. Horribly mistreated, they were beaten, sun-burnt, starved, and forced to drink their own and camel urine. A slave would be worked until close to death and then either traded or killed.
Once back on American shore, Riley devoted himself to anti-slavery work but eventually returned to a life at sea. He died March 13, 1840, on his vessel the Brig William Tell between New York and St. Thomas, "of disease caused by unparalleled suffering more than twenty years previous during his shipwreck and captivity on the desert of Sahara." The lives of his crew were foreshortened, no doubt, from complications caused by their hardships in the African desert. The last surviving crewman was the cabin boy, who lived to be 82.
In 1851, eleven years after Riley's death at sea, the publishing firm of G. Brewster issued the book Sequel to Riley's Narrative: Being a Sketch of Interesting Incidents in the Life, Voyages and Travels of Capt. James Riley, from the Period of His Return to His Native Land, After His Shipwreck, Captivity and Sufferings Among the Arabs of the Desert, as Related in His Narrative, Until His Death.
Abraham Lincoln, who later became president of the United States, listed Sufferings in Africa, as one of the three most influential works that shaped his political ideology, particularly his views on slavery. The others were the Bible and The Pilgrim's Progress (1678).