Lacking direction from the Ottoman government, Tripoli lapsed into a period of military anarchy during which coup followed coup and few deys survived in office more than a year. One such coup was led by Turkish officer Ahmed Karamanli. The Karamanlis ruled from 1711 until 1835 mainly in Tripolitania, but had influence in Cyrenaica and Fezzan as well by the mid 18th century. Ahmed was a Janissary and popular cavalry officer. He murdered the Ottoman Dey of Tripolitania and seized the throne in 1711. After persuading Sultan Ahmed III 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. Ahmed greatly expanded his city's economy, particularly through the employment of corsairs (pirates) on crucial Mediterranean shipping routes; nations that wished to protect their ships from the corsairs were forced to pay tribute to the pasha. Ahmad's successors proved to be less capable than himself, however, the region's delicate balance of power allowed the Karamanli to survive several dynastic crises without invasion. The Libyan Civil War of 1791–1795 occurred in those years. In 1793, Turkish officer Ali Benghul deposed Hamet Karamanli and briefly restored Tripolitania to Ottoman rule. However, Hamet's brother Yusuf (r. 1795–1832) reestablished Tripolitania's independence.