Between the 7th and 10th cent., immigrant Muslim Arabs and Persians established trading posts along Somalia's Gulf of Aden and Indian Ocean coasts; Mogadishu began its existence as a trading station. During the 15th and 16th cent., Somali warriors regularly joined the armies of the Muslim sultanates in their battles with Christian Ethiopia.
British, French, and Italian imperialism all played an active role in the region in the 19th cent. Great Britain's concern with the area was largely to safeguard trade links with its Aden colony (founded 1839), which depended especially on mutton from Somalia. The British opportunity came when Egyptian forces, having occupied much of the region in the 1870s, withdrew in 1884 to fight the Mahdi in Sudan. British penetration led to a series of agreements (1884–86) with local tribal leaders and, in 1887, to the establishment of a protectorate. France first acquired a foothold in the area in the 1860s. An Anglo-French agreement of 1888 defined the boundary between the Somalian possessions of the two countries.
Italy first asserted its authority in the area in 1889 by creating a small protectorate in the central zone, to which other concessions were later added in the south (territory ceded by the sultan of Zanzibar) and north. In 1925, Jubaland, or the Trans-Juba (east of the Juba [now Jubba] River), was detached from Kenya to become the westernmost part of the Italian colony. In 1936, Italian Somaliland was combined with Somali-speaking districts of Ethiopia to form a province of the newly formed Italian East Africa. During World War II, Italian forces invaded British Somaliland; but the British, operating from Kenya, retook the region in 1941 and went on to conquer Italian Somaliland. Britain ruled the combined regions until 1950, when Italian Somaliland became a UN trust territory under Italian control.
In accordance with UN decisions, Italian Somaliland, renamed Somalia, was granted internal autonomy in 1956 and independence in 1960. Britain proclaimed the end of its protectorate in June, 1960, and on July 1 the legislatures of the two new states created the United Republic of Somalia. In the early years of independence the government was faced with a severely underdeveloped economy and with a vocal movement that favored the creation of a "Greater Somalia" encompassing the Somali-dominated areas of Kenya, French Somaliland (now Djibouti), and Ethiopia. The nomadic existence of many Somali herders and the ill-defined frontiers worsened the problem. Hostilities between Somalia and Ethiopia erupted in 1964, and Kenya became involved in the conflict as well, which continued until peace was restored in 1967. The inhabitants of French Somaliland, meanwhile, voted to continue their association with France.
In 1969 President Abdirashid Ali Sharmarke was assassinated. The new rulers, led by Maj. Gen. Mohammed Siad Barre, dissolved the national assembly, banned political parties, and established a supreme revolutionary council with the power to rule by decree pending adoption of a new constitution. The country's name was changed to the Somali Democratic Republic.
Under Barre's leadership Somalia joined the Arab League (1974) and developed strong ties with the Soviet Union and other Communist-bloc nations. In the late 1970s, however, after Somalia began supporting ethnic Somali rebels seeking independence for the disputed Ogaden region of Ethiopia, the Soviet Union sided with Ethiopia, and Somalia won backing from the United States and Saudi Arabia. Somalia invaded the disputed territory in 1977 but was driven out by Ethiopian forces in 1978. Guerrilla warfare in the Ogaden continued until 1988, when Ethiopia and Somalia reached a peace accord.
Warfare among rival factions within Somalia intensified, and in 1991 Barre was ousted from his power center in the capital by nationalist guerrillas. Soon afterward, an insurgent group in N Somalia (the former British Somaliland) that had begun its rebellion in the 1980s announced it had seceded from the country and proclaimed itself the Somaliland Republic. In Mogadishu, Mohammed Ali Mahdi was proclaimed president by one group and Mohammed Farah Aidid by another, as fighting between rival factions continued. Civil war and the worst African drought of the century created a devastating famine in 1992, resulting in a loss of some 220,000 lives.
A UN-brokered truce was declared and UN peacekeepers and food supplies arrived, but the truce was observed only sporadically. Late in 1992, troops from the United States and other nations attempted to restore political stability and establish free and open food-aid routes by protecting ports, airports, and roads. However, there was widespread looting of food-distribution sites and hostility toward the relief effort by heavily armed militant factions.
Efforts to reestablish a central government were unsuccessful, and international troops became enmeshed in the tribal conflicts that had undone the nation. Failed attempts in 1993 by U.S. forces to capture Aidid, in reaction to an ambush by Somalis in which 23 Pakistani peacekeepers were killed, produced further casualties. Clan-based fighting increased in 1994 as the United States and other nations withdrew their forces; the last UN peacekeepers left the following year. Aidid died in 1996 from wounds suffered in battle.
The country was devastated by floods in 1997 and in the late 1990s was still without any organized government. Mogadishu and most of the south were ruled by violence. The breakaway Somaliland Republic, although not recognized internationally, continued to maintain a relatively stable existence, with Mohammed Ibrahim Egal (1993–2002), Dahir Riyale Kahin (2002–10), and Ahmed Mohamud Silanyo (2010–) as presidents; extensions of Riyale's term beginning in 2007 led to confrontations between the government and opposition. Somaliland had a growing economy and in the late 1990s began receiving aid from the European Union. The northeast (Puntland) section of the country also stablilized, with local clan leadership providing some basic services and foreign trade being carried on through its port on the Gulf of Aden. Both Puntland and Jubaland (in S Somalia) declared their independence in 1998. Although Jubaland was subsequently the scene of clan and sectarian fighting and ceased to have a separate existence, Puntland both retained its own government and participated in attempts to establish a Somali federal government.
In 2000 a five-month conference of mainly southern Somalis that had convened in Djibouti under the sponsorship of that nation's president established a national charter (interim constitution) and elected a national assembly and a president, Abdikassim Salad Hassan, who had been an official in Barre's regime. The new president flew to Mogadishu in August. A number of militias refused to recognize the new government, and officials and forces of the government were attacked several times by militia forces, and the government exercised minimal authority in the capital and little influence outside it. The establishment (Mar., 2001) of the Somali Reconciliation and Restoration Council by opposition warlords supported by Ethiopia, an overwhelming vote (June, 2001) in the Somaliland region in favor of remaining independent, and a declaration of independence (Apr., 2002) by Southwestern Somaliland, the fourth such regional state to be proclaimed, were further obstacles to the new government's acceptance.
In Oct., 2002, a cease-fire accord that also aimed at establishing a federal constitution was signed in Kenya by all the important factions except the Somaliland region. Fighting, however, continued in parts of the country. The sometimes stormy talks that followed the cease-fire were slow to produce concrete results, but a transitional charter was signed in Jan., 2004. Meanwhile, the mandate of the essentially symbolic interim government expired in Aug., 2003, but the president withdrew from talks, refused to resign, and had the prime minister (who remained involved in the talks) removed from office. In Sept., 2004, after many delays, a 275-member parliament was convened (in Kenya) under the new charter, and a new president, Abdullahi Yusuf Ahmed, a former general who had served as president of Puntland, was elected in October. Somaliland remained a nonparticipant in the transitional government (and held elections for its own parliament later, in Oct., 2005). Coastal areas of Somalia, particularly in Puntland, suffered damage and the loss of several hundred lives as a result of the Dec., 2004, Indian Ocean tsunami.
The new government was slow to move to Somalia, delayed by disputes over who would be in the cabinet, whether nations neighboring Somalia would contribute troops to African Union peacekeeping forces, and whether the government would be initially established in the capital or outside it. The disputes in Kenya boiled over into fighting in Somalia in March and May, 2005, where the forces of two warlords battled for control of Baidoa, one of the proposed temporary capitals. Some government members, allied with the speaker of the parliament, meanwhile relocated to Mogadishu.
In June the president returned to his home region of Puntland, and in July he announced plans to move south to Jowhar, the other proposed temporary capital. A coalition of Mogadishu warlords announced that they would attack Jowhar if the president attempted to establish a temporary capital there, but the president nonetheless did so. The year also saw a dramatic increase in piracy and ship hijackings off the Somalia coast, including the hijacking of a UN aid ship and an attack on a cruise ship, and in subsequent years pirate attacks for ransom off the coast were a significant problem. By 2010 Somali pirates were ranging across much of the NW Indian Ocean. The pirates were mainly based in S Puntland, around the port of Eyl; the government of Puntland was accused of colluding with them. By 2012, however, antipiracy measures in the shipping lanes had led to a large drop in ship seizures.
In Jan., 2006, the disputing Somali factions agreed to convene the parliament at Baidoa, Somalia, and the following month it met there. There were outbreaks of fighting in Mogadishu in Feb.–Mar., 2006, between militia forces aligned with unofficial Islamic courts and militias loyal to several warlords. In April, Baidoa was officially established as Somalia's temporary capital. Fighting re-erupted in Mogadishu in April and by July the Islamist militias had won control of Mogadishu and, through alliances, much of S Somalia, except for the Baidoa region. A truce in June between the government and the Islamist was not generally honored. In Aug., 2006, Galmudug was established as an autonomous region just S of Puntland.
The Islamists, who were split between moderates and hardliners, established the Union of Islamic Courts (UIC) and imposed Islamic law on the area under their control. In some areas their rule recalled that of the Taliban in Afghanistan. They were accused of having ties to Al Qaeda, which they denied, but there was apparent evidence of non-Somali fighters in the militia. Sheikh Hassan Dahir Aweys, a hardliner who became leader of the UIC shura [council], had led an Islamist group ousted from Puntland by President Yusuf, and was regarded as a threat by Ethiopia for having accused that nation of "occupying" the Ogaden.
As the UIC solidified its hold over S Somalia, taking control of the port of Kismayo in September, hundreds of Somalis fled to NE Kenya. Also in September there was an attempt to assassinate President Yusuf. There were increased tensions between the UIC and Ethiopia over the presence of Ethiopian troops in Somalia in support of the interim government, a situation that Ethiopia denied until October, when it said they were there to train government forces. Eritrea was accussed of supplying arms to the UIC, raising the specter of a wider war involving Ethiopia and Eritrea.
In Oct., 2006, government and UIC forces clashed several times over Bur Hakaba, a town outside Baidoa on the road to Mogadishu. A number of attempts over the summer to restart talks between the government and the UIC stalled over various issues. The interim government was split between those who favored negotiations with UIC and the prime minister, who strongly objected to any negotiations. In addition, the government objected to the Islamists' seizure of additional territory since the June truce, and the UIC objected to the presence of Ethiopian forces in Somalia.
After increasing tension and clashes between the two sides in November, the UIC demanded that Ethiopian troops leave or face attack. Major fighting erupted late in December, and Somali government forces supported by Ethiopian forces soon routed the Islamists, who abandoned Mogadishu and then Kismayo, their last stronghold, by Jan. 1, 2007. Fighting continued into early 2007 in extreme S Somalia. The United States launched air strikes (using carrier aircraft offshore) against suspected Al Qaeda allies of the UIC, and U.S. special forces also conducted some operations in S Somalia. The government assumed control over the capital, declared a state of emergency, and called for the surrender of private weapons. Several warlords surrendered arms and merged their militias into the army, but concern over the warlords' forces remained.
Ethiopian and government forces soon found themselves fighting militias opposed to disarmament and motivated also by interclan distrust and anti-Ethiopian sentiment and Islamist guerrillas. Fierce battles in March and April in the capital caused hundreds of thousands to flee, and hundreds died. The presence of African Union peacekeepers, who began arriving in March and were stationed in Mogadishu, did little initially to alter the situation, but the situation quieted after the government largely established control in late April. Sporadic antigovernment attacks continued, however, occasionally erupting into more intense fighting. Also in April, some prominent members and former members of the government formed an anti-Ethiopian alliance with members of the UIC; the alliance subsequently included Ethiopian rebel groups as well.
A national reconciliation conference in July–Aug., 2007, was boycotted by Islamists and some clans. Divisions in the government between the president and Prime Minister Ali Mohamed Gedi over their respective powers led to Gedi's resignation in October. That same month, tension and clashes between Somaliland and Puntland over the disputed border town of Los Anod erupted into significant fighting. In November, Nur Hassan Hussein, the head of the Somali Red Crescent, was named prime minister. By the end of 2007, some 600,000 had fled the capital due to the fighting there.
In Jan., 2008, the government officially returned to Mogadishu, but the ability of the Islamists during the year to seize and towns in S and central Somalia, including the ports of Kismayo in August and Merka (55 mi/90 km S of Mogadishu) in November, and the continuing fighting in the capital belied the government's gesture toward establishing its authority. A peace agreement was negotiated between the government and more moderate Islamist insurgents in June, 2008; in August both sides agreed to a joint police force and a phased Ethiopia pullback, and in November a power-sharing agreement was signed. More militant Islamists, however, rejected the agreements, which did not diminish violence in Somalia. Radical Islamists continued to make gains, and there was fighting between the radicals and more moderate Islamists; government control was restricted mainly to Mogadishu and Baidoa.
President Yusuf attempted to dismiss Prime Minister Nur in December and replace him, but Nur retained the support of the parliament. Yusuf, who was seen by many as an obstacle to the power-sharing agreement with the moderate Islamists, subsequently resigned. In Jan., 2009, Ethiopian forces withdrew from Somalia, although occasional incursions occurred in subsequent months and years; moderate Islamists joined the government the same month. Sheikh Sharif Sheikh Ahmed, a moderate Islamist, was elected president; Omar Abdirashid Ali Sharmarke, son of the country's first president, became prime minister the following month.
Hardline Islamists continued their attacks, however, capturing Baidoa in January and other towns in the following months, gaining control of most of S and central Somalia. Fighting also occurred in the Mogadishu, becoming heavy beginning in May when hardliners seized large areas in the capital (though the government, defended primarily by AU peacekeepers, retained control of key buildings and infrastructure); fighting, at times heavy, has continued off and on in Mogadishu since then. In May, 2009, the interim government officially adopted Islamic law.
By July, 2009, an estimated 1.2 million Somalis had been displaced within Somalia by the fighting; some 300,000 were in border areas in Kenya. Tensions between hardline allies turned violent in Sept.–Oct., 2009, when two groups briefly fought for control of Kismayo, and fighting between some hardline factions has continued sporadically in S Somalia. Divisions within the hardliners have been outweighed, however, by the weakness and corruption of the interim government, which in 2010 experienced a power struggle between the president and prime minister. Tensions between the prime minister and parliament led the president to dismiss Sharmarke in May, 2010, but the prime minister denounced the move as unconstitutional and ultimately remained in office. In Sept., 2010, however, amid worsening power struggles in the government, the prime minister resigned; Mohamed Abdullahii Mohamed, a former diplomat succeeded him in October.
In July, 2010, meanwhile, Somali hardline Islamists mounted suicide bomb attacks in Kampala, Uganda, in retaliation for Uganda's participation in the peacekeeping forces in Somalia. A failed militant offensive in August to seize control of Mogadishu and divisions within the dominant militant group, Al Shabab, led to some territorial gains in the capital by African Union forces that continued into 2011. In Dec., 2010, the two main hardline Islamist groups, Al Shabab and Hizbul Islam, announced that they had merged.
In Feb., 2011, the transitional parliament voted to extend its term, which was due to expire in Aug., 2011, by three years; in March, the mandate of the government, due to expire at the same time, was extended for a year. In June, 2011, however, an agreement negotiated by Uganda between the president and the parliament speaker called for extending presidential and legislative terms until Aug., 2012, when new leaders would be chosen. Additionally, the agreement called for the resignation of the prime minister and the formation of a new government, and in June, Abdiweli Mohamed Ali, a Somali-American economist, became prime minister.
By mid-2011, food shortages due to drought had become a problem in parts of Somalia, which was hit by its worst drought in 60 years. The drought was especially dire in areas controlled by hardline Islamists, who had banned international aid groups in 2010. Some 260,000 people died and 1.5 million people migrated to the capital as a result of the famine, which ended early in 2012.
In Aug., 2011, hardline forces withdrew from most areas of Mogadishu, but their control over much of S and central Somalia was unaffected by the move, and fighting recurred in sections of the capital at times. In October, Kenyan forces invaded S Somalia to attack hardline Islamists, whom Kenya held responsible for a series of attacks in Kenya. Kenya agreed in December to incorporate its troops into the African Union forces operating in Somalia, and an offensive by government-aligned Somali forces in conjunction with AU, Kenyan, and Ethiopian troops continued into 2012. At the same time, however, the government remained divided and largely ineffective, and outside the capital a number of self-proclaimed autonomous regions and warlords sought to exercise power in areas no longer under hardline Islamist control.
In Feb., 2012, the hardline Islamist al-Shabab publicly proclaimed that it had joined its movement to Al Qaeda; the group suffered a series of setbacks in the first half of 2012, losing control in Mogadishu and other other towns. By July, many of its fighters had retreated north or toward Kismayo in the south; Kismayo was the most important urban area still under al-Shabab control. In August, a national constituent assembly approved and adopted a provisional constitution to replace the Transitional Federal Charter and a parliament was chosen by clan elders; the following month, Hassan Sheikh Mohamud, a moderate Islamist and academic, was elected president. In October, Abdi Farrah Shirdon Said, a businessman, was named prime minister.
Also in October, a Somali-Kenyan offensive took control of Kismayo as al-Shabab withdrew. Al-Shabab remained in control of many rural areas in S Somalia, and at times returned to areas from which they had been expelled after government-aligned forces withdrew. In the first half of 2013 several clan militia leaders claimed to head a new government for Jubaland in S Somalia. The formation of Jubaland, seen as a potential buffer region between central Somalia and Kenya, was supported supported by Kenyan forces but opposed by the Somali government. Subsequently control of the region was contested by the rival militias. A leader allied with Kenyan forces but opposed by the Somalia government gained power in Kismayo after fighting broke out in mid-2013, and then was recognized as the region's interim leader. In June, 2013, there was a split in Al-Shabab that subsequently led to fighting between hardline Islamists. The president survived an apparent assassination attempt unharmed in Sept., 2013. Disputes between the president and prime minister led to the latter's removal in December by a no-confidence vote; Abdiweli Sheikh Ahmed Mohamed, a development economist, was then appointed prime minister.