A suicide car bomb and a multi-hour standoff between security forces and al-Shabab militants at a hotel in the Somali capital, Mogadishu, ended in a bloodbath that left at least 17 people dead on Saturday.
"We have finally ended the siege. The last remaining militants were killed on the top floor," police Captain Mohamed Hussein said.
"The attack began with a car bomb blast at the entrance of the hotel killing six people, among them five civilians and one hotel guard," said senior police officer General Abdullahi Barise.
The gunmen shot their way into the heavily guarded Nasa-Hablod hotel after exploding a car bomb. They took an unknown number of hostages captive as they lobbed grenades and set up sniper positions on the roof.
At least four gunmen were involved in the assault, police said.
The hotel is popular with government workers, foreigners and aid workers. The dead included guards and civilians. At least 20 people were also wounded.
Somalia Selbstmordanschlag auf Nasahablood Hotel in Mogadischu
Somali government forces battled the gunmen for several hours.
Random violence
A witness, Ali Mohamud, said the militants randomly shot at guests. "They were shooting at everyone they could see," he said.
The al-Qaeda affiliated al-Shabab terrorist group claimed responsibility for the attack.
"We attacked the hotel which was frequented by the apostate government members," al-Shabab military operations spokesman Sheikh Abdiasis Abu Musab told Reuters.
Al-Shabab said the death toll stood at 20 guards and civilians.
The militants regularly carry out attacks in the countryside and the capital in a bid to oust the internationally recognized government. A car bomb attack on another hotel three weeks ago left 10 people dead, including two lawmakers.
The African Union has more than 20,000 troops in Somalia supporting the government.
The mission is under strain after Uganda announced on Friday it would withdraw 6,000 troops by the end of 2017 after the European Union cut its funding for the mission in Somalia by 20 percent.