Tunis, expelled Burghul and reestablished Tripolitania's de facto independence under nominal Ottoman suzerainty. 'Ali formally abdicated in favour of Hamet, but Yusuf deposed Hamet within several months of the restoration, and ruled as bey of Tripoli during 1795–1832. Barbary Wars In 1801, Yusuf demanded a tribute of $225,000 from United States President Thomas Jefferson. Jefferson, confident in the ability of the new United States Navy to protect American shipping, refused the Pasha's demands, leading the Pasha to unofficially declare war, in May 1801, by chopping down the flagpole before the American consulate. Jefferson responded by ordering the US Navy into the Mediterranean, successfully blockading Tripolitania's harbors in 1803. After some initial military successes, most notably the capture of the USS Philadelphia, the pasha soon found himself threatened with invasion by American ground forces following the Battle of Derna and the reinstatement of his deposed brother, Hamet Karamanli, recruited by the American army officer William Eaton. On June 10, 1805, he signed the Treaty of Peace and Amity ending the war. Decline By 1819, the various treaties of the Napoleonic Wars had forced the Barbary states to give up piracy almost entirely, and Tripolitania's economy began to crumble. Yusuf attempted to compensate for lost revenue by encouraging the trans-Saharan slave trade, but with abolitionist sentiment on the rise in Europe and to a lesser degree the United States, this failed to salvage Tripolitania's economy. As Yusuf weakened, factions sprung up around his three sons; though Yusuf abdicated in 1832 in favor of his son Ali II, civil war soon resulted. Ottoman Sultan Mahmud II sent in troops ostensibly to restore order, but instead deposed and exiled Ali II, marking the end of both the Karamanli dynasty and an independent Tripolitania. A descendant family with the same name still exists in modern Tripoli-Libya. List of rulers of the Karamanli Dynasty (1711–1835) Ahmed I (29 July 1711 – 4 November 1745) Mehmed Pasha (4 November 1745 – 24 July 1754) Ali I Karamanli (24 July 1754 – 30 July 1793) Ali Pasha (30 July 1793 – 20 January 1795), also called 'Ali Burghul' – Ottoman-supported usurper Ahmed II (20 January – 11 June 1795), also called 'Ahmed' or 'Hamet' Yusuf Karamanli (11 June 1795 – 20 August 1832) Mehmed Karamanli (1817) (1st time, in rebellion) Mehmed ibn Ali (1824) (1st time, in rebellion) Mehmed Karamanli (1826) (2nd time, in rebellion) Mehmed Karamanli (July