The death toll from a deadly attack on a hotel in Mogadishu rose to 27 on Sunday, prompting the Somali government to sack its police and intelligence chiefs.
The move came after Al-Qaeda aligned Shabaab gunmen staged coordinated bomb attacks Saturday outside the Nasa Hablod Hotel 2 before storming the building.
Two weeks ago, Mogadishu was hit by a massive truck bombing that killed 358 people in the troubled country's worst-ever attack.
Saturday's carnage was unleashed when a car bomb exploded outside the hotel entrance followed by a minibus loaded with explosives going off at a nearby intersection.
The gunmen then rushed into the popular hotel, launching a siege that lasted several hours.
Officials had initially given a toll of 14 dead, saying "most" of the casualties were civilians although a senior police official and a former MP were among them.
"Five gunmen stormed the building, two of them were killed and the rest captured alive," security ministry spokesman Abdiasiz Ali Ibrahim told reporters.
Sporadic gunfire could be heard inside the building where the gunmen had holed up, but several people managed to escape, officials said.
"Most people fled the hotel through a back door but some are still trapped inside," Mohamed Dek told AFP after managing to escape the hotel after the initial explosion.
"I was very lucky."
The Shabaab claimed the attack in a statement on its Andalus radio station, saying it was a hotel where "apostate officials" were staying.
The latest toll was given by Security Minister Mohamed Abukar Islow at a cabinet meeting at which ministers approved the dismissal of intelligence agency boss Abdillahi Mohamed Sanbalooshe and police chief Abdihakim Dahir Said.
The two were "fired for the purpose of serious accountability," said a statement, which also said police were interrogating the three captured gunmen.
The removal of the officials comes soon after the abrupt resignation of Somalia's defence minister and army chief on October 12, both of whom quit without explanation just two days before the massive truck bombing.
Although a new army chief was named the same day, General Abdi Jama Warsame, the defence portfolio remains vacant.
Somalia's President Mohamed Abdullahi Mohamed swiftly condemned Saturday's attack, saying it would not halt the country's determination to fight back.
"The violent terrorists carried out this attack to scare our people who are united to support security after the disaster on October 14. Such atrocities will neither deter nor discourage our will to fight the terrorists," he said in a statement.
In Sunday's statement, the information minister said five people had so far been arrested in connection with the October 14 attack.
To date, no group has claimed responsibility for the truck bombing, though Shabaab militants have been widely blamed.
The Nasa Hablod 2 is a popular hotel located in the north of the city whose sister hotel, the Nasa Hablod, was hit by Shabaab militants in June 2016, in an attack that killed 11 people, including a junior minister.
The Shabaab has made attacks on hotels -- commonly beginning with a suicide car bombing followed by an invasion by gunmen -- a regular strategy in its decade-long battle to overthrow successive internationally-backed governments in Mogadishu.
The Shabaab lost its foothold in Mogadishu in 2011 but has continued its fight, launching regular attacks on military, government and civilian targets in the capital and elsewhere.