What you need to know:
- The country has been embroiled in disputes with all its neighbours -- Ethiopia, Djibouti and Kenya -- sometimes leading to a breakdown in diplomatic relations.
- The Al-Qaeda-linked jihadists controlled Mogadishu until 2011 when they were pushed out by an African Union force, but still hold territory in the countryside.
Somalia, which is due to elect a new president on Sunday, is a fragile Horn of Africa nation that has been battling an Islamist insurgency for over a decade and now faces a fresh threat of famine as a severe drought takes hold.
Here are five things to know about the troubled country:
Decades of chaos
Born in 1960 from the merger of the colonies of British Somalia (Somaliland, in the north) and Italian Somalia (in the south), the country plunged into civil war in 1991, when the military regime of Siad Barre fell.
A United Nations mission from 1992 to 1995 to end a major famine and restore peace ended in failure and Somalia has since remained riven by conflict.
The Islamic Courts Union took control of the capital Mogadishu and large parts of the country in 2006 before being ousted by Ethiopian troops.
The Al-Shabaab ("the youth" in Arabic) insurgency emerged out of the Islamic Courts movement, and has been fighting to overthrow the central government for more than a decade.
The Al-Qaeda-linked jihadists controlled Mogadishu until 2011 when they were pushed out by an African Union force, but still hold territory in the countryside.
Somalia is a federation of five semi-autonomous member states -- Puntland, Jubaland, Galmudug, Hirshabelle and South West -- and a central government in Mogadishu.
A sixth region, Somaliland, declared its independence in 1991, but does not have international recognition.
Regional authorities in Puntland and Jubaland have frequently clashed with the Mogadishu government over what they see as undue interference in their affairs.
Trouble with neighbours
Somalia is located on the Horn of Africa, with more than 3,000 kilometres (1,800 miles) of coastline -- the longest coastline of an African country -- that has the Indian Ocean to the east and the Gulf of Aden to the north.
The country has been embroiled in disputes with all its neighbours -- Ethiopia, Djibouti and Kenya -- sometimes leading to a breakdown in diplomatic relations.
With a nomadic culture, Somali society has been organised for centuries on the basis of clans.
Clan affiliations affect many aspects of life, including politics. A so-called "4.5" power-sharing arrangement ensures Somalia's four major clans receive equal representation in government, with smaller clans sharing the remaining half-point.
State legislatures and clan delegates pick lawmakers for the national parliament, who in turn choose the president. In the past, the presidency has usually been won by a candidate belonging to the Hawiye or Darod clans.
Climate change disasters
An arid country whose impoverished population depends on livestock and agriculture, Somalia is considered one of the regions most vulnerable to climate change.
In recent years, increasingly extreme droughts and floods have added to the devastation caused by a locust invasion and the Covid-19 pandemic.
The country was also hit by Cyclone Gati in 2020 -- the strongest tropical storm to ever make landfall in Somalia that turned deserts into seas, displacing thousands.
The United Nations has warned that a new famine may be on the way, triggered by the worst drought in the Horn of Africa in 40 years.
Six million Somalis -- 40 percent of the population -- are facing extreme levels of food insecurity, raising the spectre of a repeat of the 2011 famine, which caused 260,000 deaths.