Somalia's special forces have killed the last of the 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 by al-Shabab militants in an area lined with hotels, shops and restaurants.
They then seized a nearby building.
The information minister said the siege had lasted so long because of the civilian human shields.
The final gunman was killed on Friday evening, almost 24 hours after the initial attack.
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 have been rescued from the building, reports say.
There are fears that the death toll will rise further.
What led to the siege?
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.
The militants are still in the building, fighting US-trained Somali troops known as the Alpha Group.
Somalia's information minister said on Friday afternoon that the use of human shields by al-Shabab had prlonged the siege.
"We could have ended this hours ago but we were concerned [about] the civilians, whom they [al-Shabab] don't mind using as shields but we would rather be the shields for them [the civilians]," Dahir Mahamud Gelle said in a televised speech.
What is the significance of Maka al-Mukarama road?
The Maka al-Mukarama road is the busiest road in Mogadishu. It has been repeatedly targeted by al-Shabab militants despite being one of the most heavily guarded roads in the country.
Hassan Haile, a prominent UK-based Somali political analyst, told the BBC that the Islamist militant group were especially drawn to the road.
"Al-Shabab like attacking Maka al-Mukarama because it is in the heart of Somalia," he said.
He told the BBC the Islamist militant group use bribes and threats to carry out their attacks:
"They either bribe with money or make it very clear that they know where the soldiers live and who their families are, to reach where they want to reach," Mr Haile said.
"There is negligence from the government, the soldiers have no money and they don't get encouragement which makes these kinds of attacks possible."
- BBC