Disclaimer: I am not an expert on Somalia. I just wrote this up in hopes that it would help others understand a bit more about what is happening there now.
Europeans began trading in Somalia in the 19th century, leading to Britain and Italy carving out territories there in order to protect their trade interests. In 1897, the British drew the boundary between Ethiopia and British Somaliland. In the years following, Italy made deals with the British and Ethiopians to mark the boundaries of Italian Somaliland. In 1936, the Italians annexed the Ethiopian region of Ogaden to Somaliland following their conquest of Ethiopia, leading to a territorial dispute that is still a source of conflict between Ethiopia and Somalia.
Italian Somaliland in green:
During WWII, Somalia was a battleground between Italy and Britain, with each invading the other’s territory multiple times. Eventually, the British gained control of most of the Italian territories.
As part of the peace treaty in 1947, Italy renounced its rights to Somaliland and the formerly Italian territories were placed under UN protection. Britain turned over Ogaden and some Somali territories to Ethiopia in 1948. In 1960, both British and Italian territories were granted independence and merged to form the Somali Republic. The constitution was formed during a conference in Mogadishu and effectively concentrated the power of the new republic in the southern (formerly Italian) territory and put Southern Somalis in key governmental positions. Reconciliation efforts with Ethiopia pursued by Prime Minister Mohamed Ibrahim Egal (1967-69) angered many Somalis, leading to a bloodless coup in 1969. Maj. Gen. Mohamed Siad Barre was placed in power and Somalia aligned itself with the Soviet Union.
In 1977, Somalia and Ethiopia went to war over the disputed Ogaden territory, a conflict that is illustrative of Cold War politics. Initially, the Soviets backed Somalia and the US backed Ethiopia. Eventually, the USSR began supporting Ethiopia (with the US then backing Somalia, naturally) and the newfound Soviet resources changed the tide of the conflict in Ethiopia’s favor. Somalis retreated and revoked the friendship agreement with the Soviets. The US became the main lifeline for Somalia, trading access to military facilities within Somalia for aid.
Barre’s regime was extremely oppressive and soon opposition movements began to rise up. Civil war brought economic difficulties, as did the corruption of the Barre government. By the end of 1980s, the northern regions had become militarized against the government and soon that militarization spread to the southern regions. The government collapsed in 1991 and Barre spent the rest of his life in exile.
Since the collapse of the Barre regime, various factions have fought for dominance and the country has lacked an effective centralized government. Several reconciliation efforts have yielded limited success, with the most recent Transitional Federal Government being set up in 2004.
The rise of Islamist groups, particularly al-Shabaab, has limited the efficacy of the Transitional Federal Government and implemented sharia law in some areas. However, they do not have widespread control throughout the country.
BBC Timeline: Somalia
US Department of State: Somalia