The history of Africa begins with the emergence of hominids, archaic humans and—at least 200,000 years ago—anatomically modern humans (Homo sapiens), in East Africa, and continues unbroken into the present as a patchwork of diverse and politically developing nation states. The earliest known recorded history arose in Ancient Egypt, and later in Nubia, the Sahel, the Maghreb and the Horn of Africa.
Following the desertification of the Sahara, North African history became entwined with the Middle East and Southern Europe while the Bantu expansion swept from modern day Cameroon (Central Africa) across much of the sub-Saharan continent in waves between around 1000 BC and 1 AD, creating a linguistic commonality across much of the central and Southern continent.
During the Middle Ages, Islam spread west from Arabia to Egypt, crossing the Maghreb and the Sahel. Some notable pre-colonial states and societies in Africa include the Ajuran Empire, D'mt, Adal Sultanate, Alodia, Warsangali Sultanate, Kingdom of Nri, Nok culture, Mali Empire, Bono State, Songhai Empire, Benin Empire, Oyo Empire, Kingdom of Lunda (Punu-yaka), Ashanti Empire, Ghana Empire, Mossi Kingdoms, Mutapa Empire, Kingdom of Mapungubwe, Kingdom of Sine, Kingdom of Sennar, Kingdom of Saloum, Kingdom of Baol, Kingdom of Cayor, Kingdom of Zimbabwe, Kingdom of Kongo, Empire of Kaabu, Kingdom of Ile Ife, Ancient Carthage, Numidia, Mauretania, and the Aksumite Empire. At its peak, prior to European colonialism, it is estimated that Africa had up to 10,000 different states and autonomous groups with distinct languages and customs.
From the mid-7th century, the Arab slave trade saw Arabs enslave Africans. Following an armistice between the Rashidun Caliphate and the Kingdom of Makuria after the Second Battle of Dongola in 652 AD, they were transported, along with Asians and Europeans, across the Red Sea, Indian Ocean, and Sahara Desert.
From the late 15th century, Europeans joined the slave trade. One could say the Portuguese led in partnership with other Europeans.[weasel words] That includes the triangular trade, with the Portuguese initially acquiring slaves through trade and later by force as part of the Atlantic slave trade. They transported enslaved West, Central, and Southern Africans overseas. Subsequently, European colonization of Africa developed rapidly from around 10% (1870) to over 90% (1914) in the Scramble for Africa (1881–1914). However following struggles for independence in many parts of the continent, as well as a weakened Europe after the Second World War (1939–1945), decolonization took place across the continent, culminating in the 1960 Year of Africa.
Portugal and Spain took the ports of Tangiers, Algiers, Tripoli, and Tunis. This put them in direct competition with the Ottoman Empire, which re-took the ports using Turkish corsairs (pirates and privateers). The Turkish corsairs would use the ports for raiding Christian ships, a major source of booty for the towns. Technically, North Africa was under the control of the Ottoman Empire, but only the coastal towns were fully under Istanbul's control. Tripoli benefited from trade with Borno. The pashas of Tripoli traded horses, firearms, and armor via Fez with the sultans of the Bornu Empire for slaves.
In the 16th century, an Arab nomad tribe that claimed descent from Muhammad's daughter, the Saadis, conquered and united Morocco. They prevented the Ottoman Empire from reaching to the Atlantic and expelled Portugal from Morocco's western coast. Ahmad al-Mansur brought the state to the height of its power. He invaded Songhay in 1591, to control the gold trade, which had been diverted to the western coast of Africa for European ships and to the east, to Tunis. Morocco's hold on