Ottoman Tripolitania

Ottoman Tripolitania, also known as the Regency of Tripoli, was officially ruled by the Ottoman Empire from 1551 to 1912. It corresponded roughly to the northern parts of modern-day Libya in historic Tripolitania and Cyrenaica. It was initially established as an Ottoman province ruled by a pasha (governor) in Tripoli who was appointed from Constantinople, though in practice it was semi-autonomous due to the power of the local Janissaries. From 1711 to 1835, the Karamanli dynasty ruled the province as a de facto hereditary monarchy while remaining under nominal Ottoman suzerainty. In 1835, the Ottomans reestablished direct control over the region until its annexation by Italy in 1912.

Like the Ottoman regencies in Tunis and Algiers, the Regency of Tripoli was a major base for the privateering activities of the North African corsairs, who also provided revenues for Tripoli. A remnant of the centuries of Turkish rule is the presence of a population of Turkish origin, and those of partial Turkish origin, the Kouloughlis.

Ottoman conquest
By the beginning of the 16th century the Libyan coast had minimal central authority and its harbours were havens for unchecked bands of pirates. The Spaniards occupied Tripoli in 1510, but the Spaniards were more concerned with controlling the port than with the inconveniences of administering a colony. In 1530 the city, along with Malta and Gozo, was ceded by Charles I of Spain to the Knights of St John as compensation for their recent expulsion from the island of Rhodes at the hands of the Ottoman Turks. Christian rule lasted then until 1551, when Tripoli was besieged and conquered by famed Ottoman admirals Sinan Pasha and Turgut Reis. Declared as Bey and later Pasha of Tripoli, Turgut Reis submitted the tribes of the interior and several cities like Misrata, Zuwara, Gharyan, and Gafsa in the next decade. These efforts contributed to cement the foundations of a statal structure in what is today Libya, but control from Constantinople remained loose at best, much like in the rest of the Barbary Coast of North Africa.

Under the Ottomans, the Maghreb was divided into three provinces, Algiers, Tunis, and Tripoli. After 1565, administrative authority in Tripoli was vested in a Pasha directly appointed by the Sultan in Constantinople. The sultan supported the pasha with a corps of janissaries who he was dependent upon, which was in turn divided into a number of companies under the command of a junior officer or bey. The janissaries quickly became the dominant force in Ottoman Libya and were also in charge of collecting taxes; however, Barbary corsairs were the ones who steadily provided income to Tripoli from privateering activities. As a self-governing military guild answerable only to their own laws and protected by a divan (a council of senior officers who advised the pasha), the janissaries soon reduced the pasha to a largely ceremonial role.

In 1611, the local chiefs of the area conducted a coup d'état and successfully appointed Suleiman Safar, their own leader, as dey (local chief). As a result, his successors continually held the title and even occasionally identified as pasha.

Karamanli dynasty and the Barbary Wars
During the 18th century, Ottoman power waned in North Africa, with the sultans ending the practice of sending pashas to Tripoli, Algiers and Tunis. The title of pasha began to assume its hereditary status.

In 1711, Ahmed Karamanli, an Ottoman cavalry officer and son of a Turkish officer and Libyan woman, seized power and founded the Karamanli dynasty, which would last 124 years. The 1790–95 Tripolitanian civil war occurred in those years.

In May 1801, Pasha Yusuf Karamanli demanded from the United States an increase in the tribute ($83,000) which it had paid since 1796 for the protection of their commerce and enslavement of crews by barbary pirates when the Treaty of Tripoli was signed. The demand was refused by third American President Thomas Jefferson, an American naval force was sent and blockaded Tripoli, and the desultory First Barbary War dragged on from 1801 until 3 June 1805. The Regency of Tripoli was defeated by the newly revived United States Navy.

The Second Barbary War (1815, also known as the Algerian War) was the second of the two wars fought between the United States and the Ottoman Turks' North African regencies of Algiers, Tripoli, and Tunis, known collectively as the Barbary States.

On 5 September 1817, Yusuf Karamanli invited the leaders of the Libyan tribe of Al-Jawazi to his castle in Benghazi, following a dispute regarding tribute and an uprising against his rule. Consequently, the Pasha ordered the execution of all attendees, and chased down the other tribe members, which resulted in the massacre of at least 10,000 people, who eventually sought refuge in neighboring countries, especially Egypt. This was known as the Al-Jawazi massacre.

Reassertion of Ottoman authority
In 1835 the government of Sultan Mahmud II took advantage of local disturbances to reassert their direct authority. As decentralized Ottoman power had resulted in the virtual independence of Egypt as well as Tripoli, the coast and desert lying between them relapsed to anarchy, even after direct Ottoman control was resumed in Tripoli. The indigenous Senusiyya (or Sanusi) Movement, led by Islamic cleric Muhammad ibn Ali al-Sanusi, called on the countryside to resist Ottoman rule. The Grand Senussi established his headquarters in the oasis town of Jaghbub while his ikhwan (brothers) set up zawiyas (religious colleges or monasteries) across North Africa and brought some stability to regions not known for their submission to central authority. In line with the expressed instruction of the Grand Sanusi, these gains were made largely without any coercion.

It was one of the first Ottoman provinces to be reclassified from an eyalet to a vilayet after an administrative reform in 1865, and by 1867 it had been reformed into the Tripolitania Vilayet.

The Ottoman sultan Abdulhamid II twice sent his aide-de-camp Azmzade Sadik El Mueyyed to meet Sheikh Sanusi to cultivate positive relations and counter the West European scramble for Africa.

The highpoint of the Sanusi influence came in the 1880s under the Grand Senussi's son, Muhammad al-Mahdi al-Sanusi. With 146 lodges spanning the entire Sahara, he moved the Senussi capital to Kufra.

Over a 75‑year period, the Ottoman Turks provided 33 governors and Libya remained part of the empire until Italy invaded for the second time in 1911.

Italo-Turkish War
The Italo-Turkish War was fought between the Ottoman Empire and the Kingdom of Italy from September 29, 1911, to October 18, 1912.

As a result of this conflict, the Ottoman Turks ceded the provinces of Tripolitania, Fezzan, and Cyrenaica to Italy. These provinces together formed what became known as Libya.

Administrative divisions
By the 19th century, the province of Tripoli, known officially as Tarablus al-Gharb ('Tripoli of the West') was organized into five sanjaks (districts): These district names were reported by James Henry Skene in 1851 and five districts of the same name existed after the reforms of the 1860s that transformed the province officially into a vilayet (or in Arabic). Among these, Cyrenaica was made an independent sanjak in 1863 that was directly dependent on Istanbul, then it was assigned to Tripoli's supervision in 1871, and finally it was attached to Istanbul again in 1888.
 * 1) Sanjak of Tarablus al-Gharb (Tripoli)
 * 2) Sanjak of Khums
 * 3) Sanjak of Jabal al-Garb
 * 4) Sanjak of Fezzan
 * 5) Sanjak of Benghazi (Cyrenaica)