structural:reformatting
Foundation and origins

The founding ethnicity of Mogadishu and its subsequent sultanate has been a topic of intrigue in Somali Studies. Ioan Lewis and Enrico Cerulli believed that the city was founded and ruled by a council of Arab and Persian families. However, the reference I.M Lewis and Cerulli received traces back to one 19th century text called the Kitab Al-Zunuj, which has been discredited by modern scholars as unreliable and unhistorical. More importantly, it contradicts oral, ancient written sources and archaeological evidence on the pre-existing civilizations and communities that flourished on the Somali coast, and to which were the forefathers of Mogadishu and other coastal cities. Thus, the Persian and Arab founding "myths" are regarded as an outdated false colonialist reflection on Africans ability to create their own sophisticated states. It has now been widely accepted that there were already communities on the Somali coast with ethnic Somali leadership, to whom the Arab and Persian families had to ask for permission to settle in their cities. It also seems the local Somalis retained their political and numerical superiority on the coast while the Muslim immigrants would go through an assimilation process by adopting the local language and culture.

Mogadishu along with Zeila and other Somali coastal cities was founded upon an indigenous network involving hinterland trade and that happened even before significant Arab migrations or trade with the Somali coast. That goes back approximately four thousand years and are supported by archaeological and textual evidences.

This is corroborated by the first century AD Greek document the Periplus of the Erythraean Sea, detailing multiple prosperous port cities in ancient Somalia, as well as the identification of ancient Sarapion with the city that would later be known as Mogadishu. When Ibn Battuta visited the Sultanate in the 14th century, he identified the Sultan as being of Barbara origin, an ancient term to describe the ancestors of the Somali people. According to Ross E. Dunn neither Mogadishu, or any other city on the coast could be considered alien enclaves of Arabs or Persians, but were in-fact African towns.

Yaqut al-Hamawi, a Muslim medieval geographer in the year 1220 describes Mogadishu as the most prominent town on the coast. Yaqut also mentioned Mogadishu as being a town inhabited by Berbers, described as "dark-skinned" and considered ancestors of modern Somalis. By the thirteenth century, Ibn Sa'id described Mogadishu, Merca and Barawa located in the Benadir coast had become Islamic and commercial centers in the Indian Ocean. He said the local people in the Benadir coast and the interior were predominantly inhabited by Somalis with a minority of Arab, Persian and Indian merchants living in the coastal towns. Ibn al-Mujawir mentions the Banu Majid who fled the Mundhiriya region in Yemen in the year 1159 and settled in Mogadishu and also traders from the port towns of Abyan and Haram.

Mogadishu is traditionally inhabited by four clans. These are the Moorshe, Iskashato, DhabarWeyne, and the Bandawow. Moorshe is regarded the oldest group in Mogadishu and is considered to be a sub-clan of Ajuran who established one of the most powerful medieval kingdoms in Africa, the Ajuran Sultanate. The Gibil Madow (Dark Skins) faction of the Benadiri are said to hail from the Somali clan groups from inland which make up the majority of Benadiris with a small minority being Gibil Cads (Light Skins) which descend from Muslim immigrants.