Somalia’s special forces have killed all three gunmen who had taken over a building in central Mogadishu, using civilians as human shields, officials say.
The attack, which killed 20 people, began late on Thursday when al-Shabab militants stormed an area lined with hotels, shops and restaurants.
They then seized a nearby building.
This was the longest siege by the militant group since it was forced out of the Somali capital in 2011.
The final gunman was killed on Friday evening, about 22 hours after the initial attack.
Ismail Muktar, the commissioner for Hamar Jajab district, told reporters about the final moments of the siege.
“The last terrorist gunman was killed after the security forces destroyed a room in which he was taking cover and the siege is over now,” he said.
Al-Shabab has said it was behind the attack in the busy Maka al-Mukarama road, which has also injured more than 60.
A number of civilians were rescued from the building.
There are fears that the death toll could rise further.
An al-Shabab fighter blew himself up in a car, destroying other cars on the road and the front of Hotel Maka al-Mukarama, witnesses say.
The secretary-general of the National Union of Somali Journalists (NUSOJ) Mohamed Moalimuu was inside the Hotel Maka al-Mukarama with a colleague when they heard gunshots followed by a blast.
The suicide car explosion was then followed by gunshots from other al-Shabab militants who stormed an adjacent building.
US-trained Somali troops known as the Alpha Group were called in to surround the building and end the siege.