de facto rulers. In 1711, Ahmed Karamanli, a Janissary officer of Turkish origin, killed the Ottoman governor, the "Pasha", and established himself as ruler of the Tripolitania region. By 1714, he had asserted a sort of semi-independence from the Ottoman Sultan, heralding in the Karamanli dynasty. The Pashas of Tripoli were expected to pay a regular tributary tax to the Sultan but were in all other aspects rulers of an independent kingdom. This order of things continued under the rule of his descendants, accompanied by the brazen piracy and blackmailing until 1835 when the Ottoman Empire took advantage of an internal struggle and re-established its authority. The Ottoman province (vilayet) of Tripoli (including the dependent sanjak of Cyrenaica) lay along the southern shore of the Mediterranean 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. A 16th century Chinese source mentioned Tripoli and described its agricultural and textile products. Barbary Wars 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 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 under the 1796 Treaty with Tripoli. The demand was refused by third President Thomas Jefferson, and a naval force was sent from the United States to blockade Tripoli. The First Barbary War (1801-1805) dragged on for four years. In 1803, Tripolitan fighters captured the U.S. Navy heavy frigate Philadelphia and took its commander, Captain William Bainbridge, and the entire crew as prisoners. This was after the Philadelphia was run aground when the captain tried to navigate too close to the port of Tripoli. After several hours aground and Tripolitan gun boats firing upon the Philadelphia, though none ever struck the Philadelphia, Captain Bainbridge made the decision to surrender. The Philadelphia was later turned against the Americans and anchored in Tripoli Harbor as a gun battery while her officers and crew were held prisoners in Tripoli. The following year, U.S. Navy Lieutenant Stephen Decatur led a successful daring nighttime raid to retake and burn the warship rather than see it remain