Al-Shabab militants have fired mortars at Somalia's presidential palace, sparking deadly battles in which at least 14 people have died.
Government forces, backed by African Union peacekeepers, returned fire in a bid to repel the advance by the al-Qaeda-inspired group in Mogadishu.
President Sheikh Sharif Ahmed was not in the building at the time, as he was in Turkey for a peace conference.
His UN-backed government only controls a few parts of the shattered nation.
The militants attacked the capital's northern Shibis and Bondhere districts, leading to fierce fighting.
Among the dead were five members of a single family killed when a mortar landed on their house, a Mogadishu resident told the AFP news agency, saying he had seen the bodies.
A spokesman for the AU force defended their decision to fight back against the militants.
"People need to understand what our mandate is - we are here to protect the transitional federal institutions of Somalia and we also have red lines," said Major Barigye Ba-hoku.
At the conference in Istanbul, UN chief Ban Ki-moon urged donors to back President Ahmed's government.
It has recently been hit by in-fighting but at the conference it pledged its commitment to avoid such internal disputes.
Somalia has been racked by violence for more than two decades and hundreds of thousands of people have fled their homes, creating one of the world's worst humanitarian emergencies.
Al-Shabab and other hardline Islamist groups control most of southern and central Somalia.