Somalia (; ), officially the Federal Republic of Somalia (, ) and formerly known as the Somali Democratic Republic, is a country located in the Horn of Africa.

In antiquity, the region now known as Somalia was referred to as the second "Barbaria" by the Greeks and Romans;Lionel Casson (ed.), The Periplus Maris Erythraei: Text with Introduction, Translation, and Commentary (Princeton University Press, 1989), p. 45 similarly, Arab sources, including the geographer al Idrisi, identified it as al-Barbara.Marina Tolmacheva, "Long-Distance Arab Sailing in the Indian Ocean before the Portuguese," in Early Maritime Cultures in East Africa and the Western Indian Ocean: Papers from a Conference Held at the University of Wisconsin-Madison (African Studies Program) 23–24 October 2015, with Additional Contributions, ed. Akshay Sarathi, p. 216, available at https://www.archaeopress.com/Archaeopress/download/9781784917128. The country was an important centre for commerce with the rest of the ancient world,John Kenrick, Phoenicia, (B. Fellowes: 1855), p. 199.Jeanne Rose, John Hulburd, The aromatherapy book: applications & inhalations, (North Atlantic Books: 1992), p. 94. and according to most scholars, it was the seat of ancient Land of Punt that thrived during bronze age.Christine El Mahdy, Egypt : 3000 Years of Civilization Brought to Life, (Raincoast Books: 2005), p. 297.Stefan Goodwin, Africa's legacies of urbanization: unfolding saga of a continent, (Lexington Books: 2006), p. 48.

During the classic era until the Middle Ages, several powerful Somali states and port towns dominated the regional trade, including the Sultanate of Mogadishu and the Ajuran Sultanate, both centered around the port town of Mogadishu. Additionally, the port towns of Barawe and Merca played significant roles in this commercial network which were part of the Azania city states during classic era. Preceding these medieval states were ancient civilisations such as the legendary Macrobian Kingdom, noted by Herodotus for its wealth and wisdom, and the Barbario civilisation, an early pre-Islamic civilisation that helped lay the foundations for the region's prosperous trade routes.

In the late 19th century, through a succession of treaties with these kingdoms, the Italian colonial empire gained control of parts of the coast, and established the colony of Italian Somaliland.. In southern parts of Somalia, the Italians fought a decades-long war, dubbed the Banadir Resistance, with the Somalis around the port town of Merca. Italy acquired full control of the northeastern, central and southern parts of the territory after successfully waging a Campaign of the Sultanates against the ruling Majeerteen Sultanate and the Sultanate of Hobyo. This occupation lasted until 1941 when it was replaced by a British military administration.

In 1950, the Trust Territory of Somaliland under Italian administration was established as a United Nations Trusteeship, with a promise of independence after 10 years. The State of Somaliland formerly known as British Somaliland, gained its independence from the United Kingdom five days prior to uniting as planned with the Trust Territory of Somaliland on July 1st 1960 which gained its independence on the same day. Together, they formed the Somali Republic under a civilian government, the Somali National Assembly, headed by Haji Bashir Ismail Yusuf.Greystone Press Staff, The Illustrated Library of The World and Its Peoples: Africa, North and East, (Greystone Press: 1967), p. 338. The administration lasted until 1969, when the Supreme Revolutionary Council led by Mohamed Siad Barre, seized power in a bloodless coup and renamed the country the Somali Democratic Republic. In 1991, the Somali Civil War divided the entire country. Despite the establishment of the Interim, Transitional, and Federal governments, Somalia remains divided with Somaliland gaining de facto independence.

Prehistory

Somalia has been inhabited since at least the Paleolithic, when the Doian and Hargeisan cultures flourished. The oldest evidence of burial customs in the Horn of Africa comes from cemeteries in Somalia dating back to the 4th millennium BC. The stone implements from the Jalelo site in the north (about halfway between Berbera and Hargeisa) were also characterized in 1909 as important artefacts demonstrating the archaeological universality during the Paleolithic between the East and the West.

According to an autosomal DNA research in 2014 on ancient and modern populations, the Afroasiatic languages likely spread across Africa and the Near East by an ancestral population(s) carrying a newly identified "non-African" (Western Eurasian) genetic component, which the researchers dub the "Ethio-Somali" component. This genetic component is most closely related to the "Maghrebi" component and is believed to have diverged from other "non-African" (Western Eurasian) ancestries at least 23,000 years ago. The "Ethio-Somali" genetic component is prevalent among modern Afroasiatic-speaking populations, and found at its highest levels among Cushitic peoples in the Horn of Africa. On this basis, the researchers suggest that the original Ethio-Somali carrying population(s) probably arrived in the pre-agricultural period (12–23 ka) from the Near East, having crossed over into northeast Africa via the Sinai Peninsula and then split into two, with one branch continuing west across North Africa and the other heading south into the Horn of Africa. A similar view has already been proposed earlier, suggesting that the ancestors of Afroasiatic speakers could have been a population originating in the Near East that migrated to Northeast Africa during the Late Palaeolithic with a subset later moving back to the Near East. According to Anthropologists, the ancestors of the Somali people arrived in the region during the ensuing Neolithic period.Zarins, Juris (1990), "Early Pastoral Nomadism and the Settlement of Lower Mesopotamia", (Bulletin of the American Schools of Oriental Research)Diamond J, Bellwood P (2003) Farmers and Their Languages: The First Expansions SCIENCE 300,

The Laas Geel cave complex on the outskirts of Hargeisa in northwestern Somalia has rock art which dates back around 5,000 years and has depicting both wild animals and decorated cows. Other cave paintings are found in the northern Dhambalin region, which feature one of the earliest known depictions of a hunter on horseback. The rock art is in the distinctive Ethiopian-Arabian style, dated to 1000 to 3000 BCE. Additionally, between the towns of Las Khorey and El Ayo in northern Somalia lies Karinhegane, the site of numerous cave paintings of real and mythical animals. Each painting has an inscription below it, which collectively have been estimated to be around 2,500 years old.

Ancient Ancient Somalia domesticated the camel somewhere between the third millennium and second millennium BCE from where it spread to Ancient Egypt and North Africa.Suzanne Richard, Near Eastern archaeology: a reader. p. 120

Land of Punt Ancient pyramidical structures, mausoleums, ruined cities and stone walls found in Somalia (such as the Wargaade Wall) are evidence of an old sophisticated civilization that once thrived in the Somali peninsula. The findings of archaeological excavations and research in Somalia show that this civilization enjoyed a lucrative trading relationship with Ancient Egypt and Mycenaean Greece since the second millennium BCE. This supports the hypothesis of Somalia and/or the adjacent Horn territories corresponding with the ancient Land of Punt. The Puntites traded myrrh, spices, gold, ebony, short-horned cattle, ivory and frankincense with the Ancient Egyptians, Phoenicians, Babylonians, Indians, Chinese and Romans through their commercial ports. An Ancient Egyptian expedition sent to Punt by the 18th dynasty Queen Hatshepsut is recorded on the temple reliefs at Deir el-Bahari, during the reign of the Puntite King Parahu and Queen Ati. According to Christiane Noblecourt, these expeditions were further facilitated by the existence of a common language between Egypt and Punt. Traces of these ties also survive in Somali folklore. One recorded myth describes the origin of the Egyptian Pharaohs as follows:

"There were once two brothers: one tall and strong, the other short and thin; they lived in the Peninsula. One day the little one, very jealous of his brother, went north and settled in Egypt. And since he had an inferiority complex, he built great pyramids and sculpted huge statues."

One of the main scholarly work on Punt, written from a native Somali standpoint, was by Somali historian Muxamed Ibraahim Muxamed, who wrote the work: Taariikhda Soomaaliya: dalkii filka weynaa ee punt.Taxanaha taariikhda Soomaaliya - Page 332, Abdulaziz Ali Ibrahim · 2006

Somali City States Ancient urban centers and trade networks in Somalia have long attracted scholarly attention. Archaeological surveys in northern Somalia have identified over seventy ruined towns, including four urban centers that date to around 2,000 years ago: Salweyn (Mundus), Daamo (Cape of Spices), and two settlements in Xaafun (Opone). Archaeological research indicates a culture of literacy in these city-states, as hundreds of ancient inscriptions have been uncovered, including as-yet-undeciphered indigenous scripts.

Little is known about the dynasties that ruled these city-states. One local tradition recounts a King of Barbary who had two daughters, "Hoobaal" and "Heelley," stating that the king's love for them was so great that it compelled future generations of Somali composers and poets to introduce their names at the beginning or end of their works. Additionally, some depictions of rulers from these city-states, dating to roughly 2,000 years ago, have been identified, potentially offering visual evidence of their reigns.

In the classical period, the Somali city-states of Mosylon, Opone, Malao, Sarapion, Mundus, Essina and Tabae in Somalia developed a lucrative trade network connecting with merchants from Phoenicia, Ptolemic Egypt, Greece, Parthian Persia, Sheba, Nabataea and the Roman Empire. They used the ancient Somali maritime vessel known as the beden to transport their cargo. By around 300 BC, certain historical records identify Somali sailors as among the most active in the Indian Ocean, surpassing Arab mariners in maritime trade.

After the Roman conquest of the Nabataean Empire and the Roman naval presence at Aden to curb pillaging, Somali and Gulf Arab merchants by agreement barred Indian ships from trading in the free port cities of the Arabian PeninsulaEric Herbert Warmington, The Commerce Between the Roman Empire and India, p. 54. to protect the interests of Somali and Arab merchants in the extremely lucrative ancient Red Sea–Mediterranean Sea commerce.Eric Herbert Warmington, The Commerce Between the Roman Empire and India, p. 229. However, Indian merchants continued to trade in the port cities of the Somali Peninsula, which was free from Roman interference.Eric Herbert Warmington, The Commerce Between the Roman Empire and India, p. 187.