The history of West Africa can be divided into five major periods: first, its prehistory, in which the first human settlers arrived, developed agriculture, and made contact with peoples to the north; the second, the Iron Age empires that consolidated both intra-Africa, and extra-Africa trade, and developed centralized states; third, major polities flourished, which would undergo an extensive history of contact with non-Africans; fourth, the colonial period, in which Great Britain and France controlled nearly the entire region; and fifth, the post-independence era, in which the current nations were formed.
Early human settlers from northern Holocene societies arrived in West Africa around 12,000 B.C. Sedentary farming began in, or around the fifth millennium B.C, as well as the domestication of cattle. By 1500 B.C, ironworking technology allowed an expansion of agricultural productivity, and the first city-states later formed. Northern tribes developed walled settlements and non-walled settlements that numbered at 400. In the forest region, Iron Age cultures began to flourish, and an inter-region trade began to appear. The desertification of the Sahara and the climatic change of the coast cause trade with upper Mediterranean peoples to be seen.
The domestication of the camel allowed the development of a trans-Saharan trade with cultures across the Sahara, including Carthage and the Berbers; major exports included gold, cotton cloth, metal ornaments, and leather goods, which were then exchanged for salt, horses, textiles, and other such materials. Local leather, cloth, and gold also contributed to the abundance of prosperity for many of the following empires.
The development of the region's economy allowed more centralized states and civilizations to form, beginning with Dhar Tichitt that began in 1600 B.C. followed by Djenné-Djenno beginning in 300 B.C. This was then succeeded by the Ghana Empire that first flourished between the 9th and 12th centuries, which later gave way to the Mali Empire. In current-day Mauritania, there exist archaeological sites in the towns of Tichit and Oualata that were initially constructed around 2000 B.C., and were found to have originated from the Soninke branch of the Mandé peoples, who, according to their tradition, originate from Aswan, Egypt. Also, based on the archaeology of city of Kumbi Saleh in modern-day Mauritania, the Mali empire came to dominate much of the region until its defeat by Almoravid invaders in 1052.