Three more civilians have been injured.
“The security forces rescued and took out many other civilians from the house and other buildings nearby during the attack,” the government said.
The jihadist group has also claimed responsibility for the attack.
The government in Mogadishu has enjoyed military success against the extremist movement, partly with the help of US air support and ground support from the African Union. But al-Shabaab, which has links to the al-Qaeda terror network, controls areas of the Somali countryside.