The military history of Somalia encompasses the major conventional wars, conflicts and skirmishes involving the historic empires, kingdoms and sultanates in the territory of present-day Somalia, through to modern times. It also covers the martial traditions, military architecture and hardware employed by Somali armies and their opponents.
In the early Middle Ages, the Ajuran Empire expanded its territories and established its hegemonic rule through a skillful combination of warfare, trade linkages and alliances, and defeated the Portuguese many times in the Indian Ocean. The Kingdom of Ifat successfully conquered the Kingdom of Shewa in the same time-period. A hundred years later a major conventional war would commence during the Conquest of Abyssinia pitching the Kingdom of Adal allied by the Ottoman Empire against the Solomonic Dynasty supported by the Portuguese Empire. The conflict is the earliest example of cannon and matchlock warfare on the continent.
The early modern period saw the rise and fall of the Gobroon Dynasty, a southern military power that successfully subdued the Bardera militant's and forced the Omanis to pay tribute. This period also saw an increased focus by Global Empires on colonial expansion. The three major imperial powers of Britain, Italy and France consequently sought and signed various protectorate treaties with the ruling Somali Sultans, such as Mohamoud Ali Shire of the Warsangali Sultanate, Osman Mahamuud of the Majeerteen Sultanate and Yusuf Ali Kenadid of the Sultanate of Hobyo. Supplied with military hardware by the European powers, the Ethiopian Empire also sought to expand its own influence in the Horn region. These competing influences gave birth to the Dervish State, a polity wherein the monarch was Diiriye Guure, whilst its emir was Sayyid Mohammed Abdullah Hassan ("The Mad Mullah"). The Dervish forces successfully repulsed the British Empire in four military expeditions and forced it to retreat to the coastal region, remaining independent throughout World War I. After a quarter of a century of holding the British at bay, the Dervishes were finally defeated in 1920, when Britain for the first time in Africa used airplanes to bomb the Dhulbahante garesas at the Dervish capital of Taleh, Somaliland.
World War II saw many Somali men join Italian forces during the Second Italo-Abyssinian War and during the East African Campaign; and later also British forces in the Pacific War. After independence, the Somali Republic adopted an irredentist foreign policy with the intention to reconstruct the pre-WW2 borders (of Somalia Governorate) and establish an all-encompassing Greater Somalia. This culminated in several conventional wars and border skirmishes in the form of the 1964 Border War, the Shifta War, the Ogaden War, the Rhamu Incident, and the 1982 Border war, which pitched the Somali military against other forces. The fallout from these various conflicts also forged new partnerships. By the end of the 1980s, Somalia's initial friendship with the Soviet Union and subsequent partnership with the United States enabled it to build the largest army on the continent. The armed forces largely disbanded with the onset of the civil war in the early 1990s, but were later gradually reconstituted in the 2000s (decade) with the establishment of the Transitional Federal Government.
Ancient and Medieval
Ancient Somalia
In the northern Dhambalin region of Somalia, a depiction of a man on a horse is postulated as being one of the earliest known examples of a mounted huntsman. A 17th-century BC text found in a tomb in El Kab, belonging to the local governor, Sobeknakht II, mentions “a huge attack from the south on El Kab and Ancient Egypt by the Kingdom of Kush and its allies from the Land of Punt”. In ancient times Somalia was known to the Chinese as the "country of Pi-pa-lo", which had four departmental cities each trying to gain the supremacy over the other. It had twenty thousand troops between them, who wore cuirasses, a protective body armor.
Ifat-Solomonic Wars
In the early Middle Ages, the Muslim and Christian kingdoms of modern Somalia and Ethiopia enjoyed friendly relations for centuries. The conquest of Shewa by the Ifat Sultanate ignited a rivalry for supremacy between the Christian Solomonids and the Muslim Ifatites which resulted in several devastating wars. After the wars, the reigning king had his minstrels compose a song praising his victory, which contains the first written record of the word "Somali". Sa'ad ad-Din II's family was subsequently given safe haven at the court of the King of Yemen, where his sons regrouped and planned their revenge on the Solomonids.