The United Nations' gradual, peaceful return to Somalia was shattered this morning as a truck full of explosives was detonated at the front gates of its compound in the capital, Mogadishu.
Less than a month after declaring the end of the transition period in the East African country and reinforcing its mission, the UN came under sustained attack from Islamist militants al-Shabaab.
After an explosion, seven gunmen, from what the al-Qa'ida affiliate calls its "martyrdom brigade", ran into the compound. A battle lasting more than an hour ensued, as African Union peacekeepers and security guards fought the militants. At least 20 people were killed, including the seven terrorists and four of the security forces. Most of the UN staff inside found shelter in a secure bunker within the building, but not everyone made it.
"There was not very much time to get into the safe area," said UN spokesman Ben Parker, who warned there may be news of more casualties.
The initial blast sprayed shrapnel and masonry across a busy street, killing at least five civilians and wounding many more. Inside the compound, reports suggested that two South African de-mining experts, as well as a Kenyan and a Somali member of UN staff were among at least 20 dead. A Somali government official said all seven attackers had been killed.
Throughout the assault, a Twitter account purporting to represent the Somali militants gave live commentary, claiming that the attackers had killed 16 UN workers, including three Britons, two Kenyans and a South African. The Foreign Office is investigating reports of British casualties.
Survivors were evacuated to the Amisom military base only a few metres away, which is the closest that Mogadishu has to a green zone.
The attack comes after a prolonged period of optimism during which Britain reopened its embassy in Mogadishu and the new President, Hassan Sheikh Mohamud, was fêted at a London donors conference in May.
Earlier this month the UN declared the end of a troubled eight-year political transition in Somalia and appointed former British ambassador, Nick Kay, as special envoy. Speaking last night, he said that the attack would not prompt the organisation to withdraw from the nation: "The UN is here to help and we are here to stay."
Mr Kay condemned the attack on the humanitarian and development workers: "This was an act of blatant terrorism and a desperate attempt to knock Somalia off its path of recovery and peace-building," he said. President Mohamud called al-Shabaab a "disgrace" to Somalia last night but insisted his country had "turned a corner".
Much has been made of the first Somali President to be elected since the collapse of the central government and the descent into civil war in 1991. That conflict was sustained by stockpiles of arms left over from the Cold War and topped up by various foreign governments including the US, which backed the corrupt and ineffective Transitional Federal Government that was dismantled last year.
However, the new Somali leader was selected, not elected. He was chosen by a new tranche of unelected MPs after days of clan-based political horse-trading in a deeply flawed process last September. The fact that the former university dean and civil rights activist was an improvement on his predecessor, Sheikh Sharif Sheikh Ahmed, was an almost accidental outcome.
The security gains made since al-Shabaab left Mogadishu at the height of a terrible famine two years ago are constantly threatened. Last month a car bomb was rammed into a convoy of Qatari officials travelling with Somalia's Interior Minister.
Neither the minister nor the visitors were hurt, but 11 bystanders were killed. A fortnight previously gunmen stormed the Supreme Court complex, killing at least 30 people and fighting gun battles with police and soldiers.