Seven al Qaida-linked militants on a suicide mission attacked have a UN compound in Somalia with a truck bomb and then poured inside, killing at least 13 people before dying in the assault.
At least three foreigners were killed during the raid in the capital Mogadishu, where the United Nations expanded its presence this year, about 18 months after Islamic insurgents were pushed from the seaside city.
Militant group al-Shabab claimed the attack, calling the UN "a merchant of death".
African Union forces expelled al-Shabab from Mogadishu in August 2011, ending years of daily violence that had caused the rest of the world to shun the capital for two decades. After the removal of al-Shabab, the international community had started trickling back into the capital, and the UN began moving in its personnel from Kenya, a process that accelerated in recent weeks.
The new attack underscores the fragile security situation and will force the UN and embassies to review safety plans and decide if they have the resources to withstand a sustained assault from al-Shabab.
UN secretary-general Ban Ki-moon, who expressed outrage over the attack, commended the UN security guards who defended the compound, said UN deputy spokesman Eduardo del Buey.
The UN Security Council later reiterated its willingness "to take action against those whose behaviour threatens the peace, stability or security of Somalia".
Susan Rice, the US ambassador to the UN, condemned the "brazen assault on civilians working for peace".
Somali prime minister Abdi Farah Shirdon said he was appalled by "such barbaric violence". An African Union official, Mahamet Saleh Annadif, condemned the "cowardly" attack and sent condolences to the families of the victims.
The top UN official on Somalia, Nicholas Kay, who was not in the compound when it was attacked, said he was horrified by the attack. "The United Nations common compound houses UN personnel working on humanitarian and development issues for the Somali people. This was an act of blatant terrorism and a desperate attempt to knock Somalia off its path of recovery and peace-building," he said.