Somali special forces say they have ended a siege at a hotel in the capital Mogadishu that was stormed by armed al-Shabab militants.
At least 12 people were killed at the beachside Elite Hotel, in addition to five militants, according to the police.
The attackers detonated a car bomb outside the hotel on Sunday before storming it and seizing hostages.
The recently built hotel is owned by an MP and is popular with officials.
Witnesses said the initial blast was heard across Mogadishu and there was chaos as people fled the area.
Security forces sealed off the hotel and exchanged fire with the gunmen inside. Four hours later, government spokesman Ismael Mukhtaar Omar tweeted that the siege was over and all the gunmen had been killed.
A senior official from the information ministry and another official from the defence ministry are reported to be among the dead, along with three hotel guards. Dozens more people were reported to be wounded.
More than 200 people were rescued from the hotel, according to the government spokesman.
The privately-owned Somali news website Dhacdoone described the hotel as one of the most heavily guarded facilities in Mogadishu.
An earlier statement posted online and attributed to al-Shabab said: “The mujahideen have launched an operation consisting of martyrdom [suicide bombing] and a commando raid against a hotel belonging to an MP from the apostate group [Somali government].”
Al-Shabab, which is linked to al-Qaeda, has been waging a brutal insurgency in Somalia for more than a decade.
It has been pushed out of Mogadishu by government and African Union troops, but the group still carries out bombings and assassinations in the city.
Over the past two months attacks by the jihadist group have increased in the capital.
Last week a shootout between jailed al-Shabab members and security officers at a prison claimed at least 20 lives.
The militants – who had managed to obtain weapons – had tried to escape from a heavily guarded prison in Mogadishu.Follow us on social media