A suicide bomber has attacked a government office in the Somali capital, Mogadishu, causing a nearby school to collapse, police say.
The car bomb in Howlwadag district killed three soldiers and injured 14 people, including six children, local officials told BBC Somali.
The blast also damaged nearby houses and blew the roof off a mosque.
The militant group al-Shabab, which has waged an insurgency for more than 10 years, said it carried out the attack.
Police officer Abdullahi Hussein told Reuters that a suicide bomber had rammed a car into the district office of Howlwadag.
Somalia has faced instability and violence since 1991, when the military government was overthrown.
The ousting of Mohamed Siad Barre led to a decades-long civil war between rival warlords, and two northern regions – Somaliland and Puntland – effectively broke away from Somalia.
Much of the country has effectively been a war zone.
A UN-backed unity government was formed in 2012. Al-Shabab has since been driven out of many urban areas but still controls territory in rural regions and carries out gun attacks and bombings on military and civilian targets.
The militant group has imposed a strict version of Sharia in areas under its control, including stoning to death women accused of adultery and amputating the hands of thieves.