In the early 18th century, the Ottoman Empire was losing its grip on its North African holdings, including Tripoli.
After persuading the Ottomans to recognize him as governor, Ahmed established himself as ruler and made his post hereditary.
Though Tripoli continued to pay nominal tribute to the Ottoman padishah, it acted otherwise 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.
Ahmed's successors proved less capable rulers, however, and the kingdom was soon wracked by internal strife.