James Leander Cathcart James Leander Cathcart ( 1 June 1767 – 6 October 1843 ) was a diplomat , slave , and sailor . He is notable for his narrative as a slave in Algiers for eleven years . Revolutionary War . Cathcart was born in Mount Murragh , County Westmeath , Ireland and emigrated to the North American colonies at eight years of age , under the care of a relative , Captain John Cathcart . He joined the American Revolution and at the age of twelve served on a privateer . Three years later , as a midshipman on " The Confederacy " , he was captured by the British and imprisoned on the prisoner ships , " The Good Hope " and from which he escaped in 1782 . He became fluent in Spanish and French , which he learned from fellow prisoners during his three year internment . Slave in Algiers . In 1785 Barbary pirates captured the American merchant ship " The Maria Boston " , on its way to Cadiz carrying furs , lumber , and dried codfish . They took Cathcart and twenty other sailors as slaves . During the eleven years of his slavery in Algiers Cathcart managed by means of good fortune , cleverness , and bribery to improve his circumstances , eventually becoming chief clerk to the Dey . In this position , he acted as a mediator between the Dey and Joseph Donaldson , Jr . agent for Colonel David Humphreys , the US Minister to Portugal , that resulted in The Treaty of Algiers of 1796 and made possible his freedom . Cathcart , for the first several years of his captivity , endured the same terrible living conditions as his fellow slaves . One of a few handpicked by the Dey , Cathcart ’ s first duties were to work in the Dey ’ s palace garden caring for the lions , tigers , and antelopes . Although his assigned duties were relatively light , his masters provided scant food and administered several beatings , called bastinado , where in one instance Cathcart lost several of his toenails . As his fortunes and positions in Algiers improved , Cathcart acquired additional skills that he used later as a diplomat . He found opportunities to demonstrate his concern for his fellow prisoners . During his slavery he became conversant in Arabic and Turkish . When Cathcart became clerk of the prison , he was able to buy several taverns , a house with servants , and procure more food for his fellow crew members . After the Treaty of Algiers freed them , Cathcart had the means to purchase a ship , which he sailed to Philadelphia in 1796 with twelve surviving members of the original crew . Personal . On 5 June 1798 he married Philadelphia belle Jane Bancker Woodside , and they had twelve children . His daughter JB Newkirk put together Cathcart ’ s narrative and published it in 1899 , 56 years after his death , under the title of " The Captives , Eleven Years a Prisoner in Algiers " . Professional diplomatic career . He returned to the Barbary States in December 1798 , as special agent to William Eaton . In 1802 , he was appointed US Consul ( representative ) to Tunis and Tripoli . He participated in the negotiation of additional treaties with Algiers , Tunis , and Tripoli . He served as Consul - General for the United States in Cadiz from 1807 – 17 . Cathcart served in the diplomatic corps for the United States during the administrations of John Adams , Thomas Jefferson , and James Madison .