The move came after Al-Qaeda aligned Al-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.
Related content: Two explosions rock Somali capital
“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 Al-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.