After 20 years of civil conflict, Somalia has once again been given a stark reminder of the challenges facing its UN-backed government.
A fragile peace has again been shattered, in the most serious attack on Mogadishu since al-Shabab fighters were forced out of the capital in 2011.
"It is very tragic but that does not necessarily mean that the government doesn't have any capacity to defeat al-Shabab. Al-Shabab, as you can see now, is a criminal outfit and is no longer a fighting machine. I agree that the government doesn’t have much capacity but like any other country that comes out of a post-conflict position ... I think they are doing a very good job."
- Abdurahman Hosh Jibril, Somali member of parliament
Suicide commandos forced their way into the Supreme Court complex, spraying gunfire and detonating explosives. It is another setback for a country that is making small political gains while struggling to establish a credible army and security force.
Critics argue that the army is clan-based, made up of various militias, and loyal to different warlords. They are paid relatively little, with wages coming from the European Union and the United Nations. And, most serious of all, they are seen as lacking discipline, and are not trusted.
A Human Rights Watch report in March accused militias and security forces of serious abuses, including rape, beatings and ethnic discrimination, as well as restricting access to food and shelter.
Meanwhile, armed group al-Shabab, which means The Youth, is fighting for an Islamic state in Somalia. At one stage it controlled large parts of the country, but a sustained military campaign by the African Union has forced the group to give up a lot of its territory.
In August 2011, fighters were driven from the capital. Months later, they responded, attacking buildings housing the transitional government, killing 82 people. The year 2012 saw the group flushed out of more towns, eventually losing their last urban stronghold of Kismayo in October.
This forced fighters to revert to guerrilla tactics, with a series of suicide and bomb attacks carried out in the capital this year, which culminated in Sunday's assault.
The man charged with improving Somalia's lot, President Hassan Sheikh Mohamud, took office in September. He is an academic and civic activist with little political experience; he is also the first elected president since 1967. He is enjoying some success.
"The security army has been built from scratch ... it hasn't yet established its own true command and control. Indeed, it was built from militia and warlords but the influence of warlords has significantly been eroded and the Somali army ethos is taking place."
- Augustine Mahiga, the UN special representative for Somalia
Under his watch, the US formally recognised the African nation's new government in January, the first time it has done that since 1991. In March, the UN Security Council voted unanimously to partially suspend an arms embargo for 12 months. And on Friday, the International Monetary Fund announced it was recognising Somalia's government after a more than 20-year break in relations.
Many of the boots on the ground in Somalia belong to soldiers from AMISOM - the African Union Mission in Somalia. It was deployed in 2007, to support the transitional government, train Somali security forces, and help battle al-Shabab.
AMISOM has a near 17,000-strong force in Somalia. It had an initial six-month mandate, but six years on, it is still operative there.
So, can Somalia win the fight against al-Shabab? And can it pull together security forces that stand accused of abuse, rape and discrimination against their own people?
For this edition of Inside Story, Hazem Sika is joined by guests: Augustine Mahiga, the UN special representative for Somalia, and head of the UN political office for Somalia; Abdurahman Hosh Jibril, a Somali member of parliament, and former minister of constitutional affairs and reconciliation; Laetitia Bader, a researcher with Human Rights Watch; and Abdi Aynte, director of the Heritage Institute for Policy Studies.