Created in 1960 from a former British protectorate and an Italian colony, Somalia collapsed into anarchy following the overthrow of the military regime of President Siad Barre in 1991.
As rival warlords tore the country apart into clan-based fiefdoms, an internationally-backed unity government formed in 2000 struggled to establish control, and the two relatively peaceful northern regions of Somaliland and Puntland effectively broke away.
The seizure of the capital Mogadishu and much of the country's south by a coalition of Islamist shariah courts in 2006 prompted an intervention by Ethiopian, and later, African Union, forces.
Since 2012, when a new internationally-backed government was installed, Somalia has been inching towards stability, but the new authorities still face a challenge from al-Qaeda-aligned Al-Shabab insurgents.
Federal Republic of Somalia
Population 15 million (UN, 2015)
Area 637,657sq km (246,201 sq miles)
Major languages Somali, Arabic, Italian, English
Major religion Islam
Life expectancy 55 years (men), 58 years (women)
Currency Somali shilling
President: Hassan Sheikh Mohamud
Hassam Sheikh Mohamud was elected by parliament in May 2022, defeating incumbent President Mohamed Abdullahi Mohamed Farmajo.
Mohamud had served a previous term as president in 2012-2017, which was dominated by the struggle against al-Shabab jihadists, and he still faces a strong challenge by the insurgency.
Somalia's disintegration is reflected in its fragmented and partisan media, which operates in a hostile environment.
Journalists and media outlets complain about intimidation at the hands of state security agencies. Nevertheless, professionally-run media outlets have emerged - in particular, FM radios with no explicit factional links.
The TV and press sectors are weak and radio is the dominant medium. Domestic web access is held back by poor infrastructure, but social media use is on the rise.
7th-19th centuries - From the 7th-century arrival of Islam onwards, modern-day Somalia is ruled by a series of at times competing sultanates.
19th century - European colonial powers gradually make inroads into Somalia's rival regional states, with the bulk of the area coming under Italian rule and the British establishing control of the northwest.
1960 - Italian Somaliland and British Somaliland become independent, merge and form the United Republic of Somalia.
1969 - Mohamed Siad Barre assumes power in coup after the assassination of the elected president; he goes on to declare Somalia a socialist state and nationalises most of the economy.
1991 - The ousting of Mohamed Siad Barre in 1991 sparks a decades-long civil war between rival clan warlords and the disintegration of central authority. Former British Somaliland declares unilateral independence.
1990s- US-spearheaded UN peacekeeping mission fails to restore peace.
2006 - Militias loyal to the Islamist Union of Islamic Courts capture Mogadishu and other parts of south after defeating clan warlords, before being driven out by Ethiopian forces.
2007-11 - An African Union peacekeeping force, Amisom, begins to deploy and Ethiopian troops withdraw in 2009. Al-Shabab - a jihadist breakaway from the Islamic Courts - advance into southern and central Somalia, prompting an armed intervention by Kenya.
2012 - Efforts to restore a central authority since 2000 finally make substantial progress, with the swearing in of the first formal parliament in more than 20 years, and the holding of the first presidential election since 1967.