The Karamanli, Caramanli, Qaramanli, or al-Qaramanli dynasty was an early modern dynasty, independent or quasi-independent, which ruled from 1711 to 1835 in Ottoman Tripolitania. The territory comprised Tripoli and its surroundings in present-day Libya. At its peak, the Karamanli dynasty's influence reached Cyrenaica and Fezzan, covering most of Libya. The founder of the dynasty was Pasha Ahmed Karamanli, a descendant of the Karamanids. The most well-known Karamanli ruler was Yusuf ibn Ali Karamanli Pasha who reigned from 1795 to 1832, who fought a war with the United States between 1801 and 1805. Ali II Karamanli marked the end of the dynasty. History In the early 18th century, the Ottoman Empire was losing its grip on its North African holdings, including Tripolitania. A period of civil war ensued, with no ruler able to hold office for more than a year. Ahmed Karamanli, a Janissary and popular cavalry officer, murdered the Ottoman governor of Tripolitania and seized the throne in the 1711 Karamanli coup. After persuading the Ottomans to recognize him as governor, Ahmed established himself as pasha and made his post hereditary. Though Tripolitania continued to pay nominal tribute to the Ottoman padishah, it otherwise acted as an independent kingdom. An intelligent and able man, Ahmed greatly expanded his city's economy, particularly through the employment of corsairs on crucial Mediterranean shipping routes; nations that wished to protect their ships from the corsairs were forced to pay tribute to the pasha. On land, Ahmed expanded Tripolitania's control as far as Fezzan and Cyrenaica before his 1745 death. Tripolitanian civil war Ahmad's successors proved to be less capable than himself, preventing the state from ever achieving the brief golden ages of its Barbary neighbors, such as Algiers or Tunis. However, the region's delicate balance of power allowed the Karamanli to survive several dynastic crises without invasion. 'Ali ibn Mehmed neglected the affairs of state in the 1780s and delegated most of his power to his eldest son Hasan, whom he appointed as bey. The assassination of Hasan Bey in June 1790 by 'Ali's youngest son Yusuf Karamanli triggered a war of succession between Yusuf and Hamet Karamanli ('Ali's middle son, whom he appointed as bey after Hasan's death). In 1793, Ottoman officer Ali Burghul intervened, deposed Hamet and briefly restored Tripolitania to Ottoman rule. However, 'Ali, Hamet and Yusuf Karamanli returned to Tripolitania in January 1794 with the aid of the bey of