Al-Qaida-linked militants attacked Somalia's presidential palace Friday. The president was unharmed but at least 17 other people were killed.
Al-Shabab quickly claimed responsibility for the attack on the palace, known as Villa Somalia.
Witnesses say the attack began with a car bomb explosion, then gunmen stormed the palace compound. African Union and Somali government soldiers fought off the assailants.
A Somali security official tells VOA that the dead include seven soldiers, at least eight attackers and two others. One of those killed, Mohamud Indha-Asse, was chief of staff in the prime minister's office.
Nick Kay is the U.N. secretary-general's special representative to Somalia. He says he heard from President Hassan Sheikh Mohamud soon after the attack.
"The first I heard of it this morning actually as a phone call from the president just after the attack had happened. He wanted to reassure me that he was unharmed, unhurt and that the attack had been unsuccessful."
In a statement, President Mohamud sent condolences to the families of those killed, and vowed that the Somali government and African Union forces would "eliminate" the group.
U.N. Secretary General Ban Ki-moon condemned the attack and called on Somalis to remain resolute in the fight against extremism.
The U.S. State Department said the attack shows once again that al-Shabab stands only for death and destruction.
Al-Shabab lost control of Mogadishu in 2011 but has mounted periodic attacks in the city.
The U.N.-backed Mohamud government is trying to restore stability to Somalia, which has endured more than two decades of lawlessness and war.