At least 23 people have died in terrorist blasts in Somalia's capital where more than 20 people were also taken hostage in a hotel.
Security forces worked to end a siege by al-Shabab extremists on the top floor of the Nasa-Hablod hotel in Mogadishu, close to the presidential palace.
Captain Mohamed Hussein said that troops regained control of the hotel on Sunday morning, having killed three attackers and captured two alive.
Saturday's blasts came two weeks after more than 350 people were killed in a massive truck bombing on a busy Mogadishu street in the country's worst-ever attack.
Al-Shabab, Africa's deadliest Islamic extremist group, quickly claimed responsibility for Saturday's attack and said its fighters were inside the hotel. As night fell, sporadic gunfire could be heard as soldiers responded.
A senior Somali police colonel and a former lawmaker were among the dead, Hussein said.
Eyewitness Mohamed Dek Haji said he survived the bombing as he walked beside a parked car that was largely destroyed by the explosion. He said he saw at least three armed men in military uniforms running toward the hotel after the suicide bombing at its gate.
Lying in a hospital bed, he added: "I think they were al-Shabab fighters who were trying to storm the hotel."
Al-Shabab often targets high-profile areas of Mogadishu.
Since the previous blast, President Mohamed Abdullahi Mohamed has been visiting regional countries to seek more support for the fight against the extremist group.
A 22,000-strong multinational African Union force in Somalia is expected to withdraw its forces and hand over the country's security to the Somali military by the end of 2020.