Originally spurred by centre-peripheral tensions, fighting broke out in 1981 between the regime of President Said Barre and the Somali National Movement, a militia primarily consisting of members from the northern Ishaq clan. Fighting intensified in the late 1980s as more clan-based militias arose. President Barre’s regime collapsed in late 1991 and as a result the UN intervened. However persistent attacks on the UN’s forces forced a withdrawal in 1994. From the mid- to late 1990s, the character of the conflict shifted as warlords fought for access to rents. Also during this period, two different peace agreements arose; the Sodere Declaration, which was mediated by Ethiopia and supported by IGAD, and the Cairo Accord, which was brokered by Egypt. Fighting, already noticeably lessened compared to the early 1990s, decreased and the more amicable environment paved the way for the Transitional Government to be formed in 2000 (replaced in 2004 by the Transitional Federal Government).
Nonetheless, opposition to the TFG arose in the form of the Islamic Courts Union (ICU), which by early 2006 had taken control of most of southern Somalia until they were ousted by an armed intervention by Ethiopia in December 2006. As a result, the ICU splintered. Hard-line ICU members formed the Takfiri organization, Harakat al-Shabaab al-Mujahideen, and launched a guerrilla campaign against the TFG. Another faction of the ICU fled to Djibouti and formed the Alliance for the Re-liberation of Somalia, which was absorbed into the ruling TFG after successful negotiations in 2007.
To deal with the new round of fighting, the UN-mandated AMISOM force was deployed in 2007. Since then, insecurity has fluctuated between the urban and rural areas as the al-Shabaab's territorial gains waver. Local militia leaders maintain de facto governance over communities. From 2009 to 2012, insecurity spilled over into the Gulf of Aden and the Indian Ocean when Somali pirates seized, looted and ransomed ships. In 2014, 'Operation Indian Ocean' was launched and in parallel with infighting among al-Shabaab, the organisation's position in Somalia has diminished slightly. However, as evidenced by large-scale attacks by al-Shabaab in northern Kenya throughout 2013-2015, the lack of security continues to destabilize the region. Al-Shabaab continues to launch surprise attacks with the aim of forcing out foreign military presence in Somalia. Targets include both military forces and civilians. The devastating attack in October 2017 in Mogadishu saw 587 fatalities and resulted in a renewed military offensive by the Somali government and African Union allies. Since 2017, the U.S. has increased its air strikes targeting al-Shabaab militants, and in December 2018 they announced to re-establish a permanent diplomatic mission in the country. Al-Shabaab has been characterized as a spoiler in the Somali peace process and have therefore been placed outside of any negotiations.