The Ottoman province (vilayet) of Tripoli (including the dependent 'sanjak' of Cyrenaica) lay along the southern shore of the Mediterranean Sea between Tunisia in the west and Egypt in the east. Besides the city itself, the area included Cyrenaica (the Barca plateau), the chain of oases in the Aujila depression, Fezzan, and the oases of Ghadames and Ghat, separated by sandy and stony wastelands. In 1911 the Encyclopedia Britannica estimated a Tripolitanian population estimated at from 800,000 to 1,300,000.
In the early part of the 19th century the regency at Tripoli, owing to its piratical practices, was twice involved in war with the United States. In May 1801 the pasha demanded from the United States an increase in the tribute ($83,000) which the U.S. government had been paying since 1796 for the protection of their commerce from piracy. The demand was refused, and a naval force was sent from America to blockade Tripoli. The war dragged on for four years, the Americans in 1803 losing the, frigate “Philadelphia,” the commander (Captain William Bainbridge) and the whole crew being made prisoners. The most picturesque incident in the war was the expedition undertaken by William Eaton with the object of replacing the pasha with an elder brother living in exile, who had promised to accede to all the wishes of the United States. Eaton at the head of a motley assembly of 500 men marched across the desert from Alexandria, and with the aid of American ships succeeded in capturing Derna. Soon afterwards (June 3, 1805) peace was concluded, the reigning pasha relinquishing his demands but receiving $60,000 as ransom for the “Philadelphia“ prisoners. In 1815, in consequence of further outrages, Captains Bainbridge and Stephen Decatur, at the head of an American squadron, again visited Tripoli and forced the pasha to comply with the demands of America.
In 1835 the Turks took advantage of a local civil war to reassert their direct authority, and after that date Tripoli was under the direct control of the Sublime Porte, rebellions in 1842 and 1844 being unsuccessful. After the occupation of Tunisia by the French (1881), the Turks increased their garrison in Tripoli considerably.