Chronicle of the Middle East and North Africa

Libya: Ottoman Control, Corsairs and Karamanli in the 16th Century

The Red Castle in Tripoli
The Red Castle in Tripoli, built by the Knights of St. John

Despite the importance of the desert trade routes, Tripoli was always oriented towards the sea. In the early 16th century the Mediterranean was a battle field between two great powers: the Habsburgs, who not only controlled the Holy Roman Empire but also Spain and its growing empire in the Americas, and the Ottomans, who took Constantinople in 1453 and expanded southwards through Syria and Egypt at the beginning of the 16th century. These two great powers vied for power at sea by seizing coastal positions. In 1510 the Spanish conquered Tripoli, but this was a strategic advance – they had no interest in governing it and in 1530 handed it over to the Knights of St. John, whom the Ottomans had expelled from Rhodes in 1522. The Spanish also gave the Knights the island of Malta, which became the main base from which they controlled the passage between the eastern and western Mediterranean. The Ottomans responded with an all-out war against the Spanish and their allies in Genoa and Malta. It was partly fought by corsairs, naval officers who acted for profit. During the 1640s Ottoman naval forces attacked numerous places on the northern coast of the Mediterranean and expelled the Spanish from their bases in Tunisia. In 1551 Turgut Reis, the Ottoman commander in the Mediterranean, took back Tripoli.

Under Ottoman control Tripoli flourished as an ideal shelter for corsairs attacking merchant ships in the Mediterranean. This sort of warfare provided great economic gains for the corsair captains, who effectively seized control of all three main North African ports – Algiers, Tunis, and Tripoli, which became the capitals of three Ottoman provinces. These were ruled by coteries of military men: corsair captains and Ottoman janissary troops nominally presided over by a pasha (governor) appointed by the Ottomans. In order to prevent attacks on their shipping, the French, Dutch, and British bombarded each of the three cities several times in the 17th century and forced the rulers to make treaties of peace. Small Christian states were unable to exert so much power, and Italian, Maltese, and Christian Greek shipping and their foreshores were repeatedly attacked by North African corsairs and retaliated in like manner. None of the three provinces was politically stable, because the various military factions fought amongst themselves. Eventually a dynastic system emerged in Tunis, bringing internal peace.


In 1711 Tripoli followed the same pattern. A cavalry officer, Ahmed Karamanli, who was half Turkish and half North African seized power and made himself pasha. He founded a dynasty that lasted for 124 years, the first locally-based rulers since Septimius Severus. Under Karamanli rule, Tripoli flourished and expanded to take in Cyrenaica and then Fezzan, in order to profit from the lucrative trans-Saharan caravan trade. They ruled autonomously and made their own peace and war with the European states, but they acted in the name of the Ottoman sultan and were nominally his governors. Ahmed Karamanli followed the Ottoman-favoured Hanafi school of Islamic law and built the largest mosque in Tripoli’s medina, using Ottoman architectural features such as the hexagonal minaret.

Caravan trade

The Karamanlis’ main source of income was the trans-Saharan caravan trade, which dealt primarily in slaves, and maritime corsairing and the protection money paid by Christian traders to avoid being attacked. When the last of the Karamanli rulers, Yusuf (reigned 1795-1832), attempted to increase his revenue by building up his fleet and beginning an expanded war on Christian shipping, he came into conflict with the newly independent United States of America. The US government refused to pay protection money, and, when Yusuf increased taxes, there was a brief civil war. In 1803 the US declared war, which they eventually won by blockading Tripoli and landing troops in Cyrenaica. This was the USA’s first foreign war and is commemorated in the US Marine Corps Hymn:

From the Halls of Montezuma,

To the shores of Tripoli;

We fight our country’s battles

In the air, on land, and sea.

Painting of the burning of the USS Philadelphia by Tripolitanians, in the harbour of Tripoli, in 1804
Painting of the burning of the USS Philadelphia by Tripolitanians, in the harbour of Tripoli, in 1804

In 1832 Yusuf abdicated in favour of his son, Ali II, and Ottoman troops landed to restore order. In effect, the Ottomans had to reconquer the country, using the tactics of colonial war employed by European powers. The sultan did not allow another dynasty to take the Karamanlis’ place: the pashas were rotated with great rapidity: in 75 years there were 33 governors. This second Ottoman period saw Tripoli incorporated into the European world economic order – and its moral order, when slavery was abolished.