The Ottoman Empire was founded at the beginning of the 14th century. Beginning in the 16th century, it also began acquiring possessions following series of wars in coastal North Africa.

Egypt
Egypt was under the rule of a Mamluk Sultanate led by Circassians and Kipchak Turks, and who also ruled Syria, Palestine, Lebanon and Jordan. After Mehmed II (the Conqueror) united most of Anatolia under Ottoman rule, the two empires became neighbours of each other where two Mamluk vassals of Turkmen origin were the  buffer states between the two. During the Ottoman-Safavid Persia war, Mamluks (or their vassals) supported Persia. Selim I (the Grim) of the Ottoman Empire used this claim as a pretext to wage a war on Mamluks. During Selim's long campaign to Egypt in 1516–18, Mamluks were defeated three times;  in the battles Marj Dabiq and Yaunis Khan on the way to Egypt and in the Battle of Ridanieh in Egypt  (The first and the third personally commanded by Selim and the second by Hadim Sinan Pasha), the grand vizier. The third battle in which Hadim Sinan Pasha fell was the final blow to Mamluks. After clashes in Cairo, the Mamluk sultan Tumanbay II was arrested and Selim annexed the whole Mamluk territory, enlarging the Ottoman Empire more than two times in only two years.

Algeria
Turkish corsair and admiral Hayreddin Barbarossa in 1516, captured the city of Algiers from Charles V.  Although initially Barbaros and his brothers were independent, after his elder brother's death,  Barbaros appealed to Selim for protection. In 1532, during the reign of  Suleiman I (the Magnificent),  Barbaros was appointed as the grand admiral of the Ottoman Navy and Algeria became an Ottoman possession.  Eventually the Ottomans began controlling the hinterland also. In 1552, Salih Reis an Ottoman admiral, marched over the Sahara and captured Touggourt.

Tunisia
In the early years of the 16th century Tunisia was ruled by Hafsid dynasty of Berber origin. Although Tunis, the most important city of Tunisia was captured by Barbaros on behalf of the Ottoman Empire in 1534, next year during the reign of Charles V, a navy of the Holy Roman Empire took the city.   In the year 1560, an Ottoman navy commanded by Piyale Pasha defeated a large navy of the Holy Roman Empire in the Battle of Djerba. After this battle Uluç Ali Reis of the Ottoman Empire captured the city for the second time in 1569 during the reign of Selim II. Two years later the city was lost to the Holy Roman Empire for the second time. Finally in 1574, an Ottoman navy commanded by the grand admiral Sinan Pasha captured the city for the third time.

Libya
After Knights Hospitaller left the island of Rhodes in 1522, some of them had settled in Tripoli, the most important city of Libya. In 1551, Ottoman admiral Turgut Reis (also known as Dragut) captured the city  with the help of Sinan Pasha. Eventually Benghazi and the hinterland Fezzan were also annexed. Between 1711 and 1835 Libya became autonomous under Karamanlı dynasty (a dynasty founded by a military ruler from Karaman, Turkey). After 1835 Mahmud II reestablished Ottoman control.

Horn of Africa
In 1538 Suleiman I sent a navy to the Indian Ocean. (see Ottoman naval expeditions in the Indian Ocean). The expeditions continued for about 30 years. Özdemir Pasha  the deputy of the admiral conquered the west bank of the Red Sea (roughly corresponding to a narrow coastal strip of Sudan and Eritrea) in 1567 during the reign of Selim II. In the late 16th century Ottoman Admiral Ali Bey established Ottoman supremacy in many cities of the Swahili coast between Mogadishu and Kilwa. Mogadishu recognised Ottoman suzerainty in 1585 and Ali Bey also established Ottoman supremacy in other regions such as Brava, Mombasa, Kilifi, Pate, Lamu and Faza. Ethiopia also experienced a brief period of Ottoman domination when the independence of the Emirate of Harar was interrupted by Ottoman-Egyptian rule which resulted in the Emirate of Harar being added as an Ottoman-Egyptian possession until being driven out by the British 10 years later.

Morocco
The Ottomans conquered Morocco or parts of Morocco numerous times; in 1554 and 1576 they conquered Fes and enthroned their candidate as the Sultan and an Ottoman vassal. During the Battle of Alcácer Quibir in 1578, they actively fought on the side of Morocco against Portugal. According to Lord Kinross Morocco fell under Ottoman influence.  In 1585, Ottoman admiral Murat Reis captured the island of Lanzarote in the Canary islands off the West African coast. Although he soon withdrew, it was notable as the sole Ottoman conquest in the Atlantic Ocean. In 1792 the Regency of Algiers had possession of the Moroccan Rif and Oujda which they then abandoned in 1795, Oujda was under Ottoman rule during 2 years. years.

Napoleon's campaign in Egypt
General Napoleon Bonaparte (later Napoleon I) of France invaded Egypt in 1798. The main Ottoman army was preoccupied in European fronts and the only defenders were local forces which were routed in the Battle of Pyramids. However Napoleon couldn't proceed much because his fleet was defeated by the British navy. In 1799 he returned and the French army evacuated Egypt following the Battle of Alexandria in 1801.

Loss of territories
The Ottoman Empire lost direct control of Egypt and the lands to the south during the revolt of Kavalalı Mehmet Ali Pasha in the 1830s. Although Egypt was still considered an Ottoman vassal, the Ottoman Empire totally lost control in the 1880s to the British Empire. By the 19th century, Ottoman control of the countries west of Egypt was also weakened. Algeria was lost in 1830  and Tunis was lost in 1881, both to France. Libya, the last Ottoman territory in Africa was lost to Italy at the end of the Italo-Turkish War in 1911.

See also
Ottoman wars in Asia
Ottoman wars in Europe

References

Sources

16th-century conflicts
Wars involving the Ottoman Empire
Ottoman Navy
History of Africa
Lists of wars by former country