Minister of Information Abdirahman Omar Osman confirmed the dismissals of Commander of Somali Police General Abdihakim Dahir Saaid and Intelligence Chief Abdullahi Mohamed Ali Sanbalolshe.
“What was expected of the security agencies was that the necessary intelligence and surveillance information should have stopped this truck," Osman told VOA.
Militants stormed the Nasa Hablod Two Hotel late Saturday following a truck bomb blast at the hotel’s gate.
Osman said five al-Shabab militants executed the attack. Police captured three, and shot another dead, while the fifth died in the truck explosion.
The al-Shabab militant group claimed responsibility within minutes of the attack.
A second car bomb blast Saturday caused injuries near the former parliament building.
Police operate checkpoints in the area, making it one of the city's most secure. The Presidential Palace, headquarters of a Somali women’s organization, a prison run by the National Intelligence and Security Agency, and other hotels are all near the Nasa Hablod Two Hotel.
It will be the second time the two officials were fired from the same positions.
General Saaid was dismissed as police chief in July 2014 after a suicide bomber drove through a checkpoint and detonated in front of the Presidential Palace. Gunmen then stormed the palace, killing several people.
Sanbalolshe was fired in September 2014 as Intel Chief after a disagreement with then-Prime Minister Abdiweli Sheikh Ahmed.
Both officials had been reappointed this past April.
The hotel targeted by al-Shabab is popular with politicians and civil servants. Among the high-profile victims was veteran politician Madobe Nunow Mohamed, who served as Interior Minister for the Southwest regional state, and previously was federal minister of the constitution, minister of information, parliament member and acting speaker of parliament.
WATCH: Mogadishu Rocked by two Explosions
Witness account
Among the dead were four victims from the same family: three children aged 6 months, 9 months and 3 years old, and their grandmother. A 6-year-old child survived the attack.
The boy's father recounted the horrific experience.
The man, who asked not to be me named because of security concerns, is a 29-year-old university student. He and his brother took their wives and children to see the children's grandparents at the hotel.
The first explosion caused chaos in the hotel. He and his brother were at the cafeteria with their father at the time of the explosion. They ran upstairs to find the children and the rest of the family on the second floor.
As the gunmen attacked, “We discussed what we do? Should we help mother to jump the window? Then we thought it’s not possible; at that point a grenade landed near us and we ran into the room,” he said.
Al-Shabab fighters followed them, shooting and throwing bombs. “They were throwing a bomb into each room followed by hail of bullets,” the man said.
His wife called out his name, and then his son. He told them to get back in the room. The man and three other residents hid in a bathroom. In another room, gunmen wounded his wife and killed their 6-month-old son.
Al-Shabab militants then found the man's mother who was shielding her 3-year-old grandson and shot both dead, the man said. Then they wounded his sister-in-law and killed her 9-month-old daughter.
The man, his brother and father survived; the wives of the two brothers were both wounded. Three of the brothers' children and the men's mother were killed.
Security raid
About three hours later, security forces entered the hotel and while they searched the second floor one of the militants detonated a suicide vest. A fierce gun fight then forced the Special Forces to retreat. At least three security officers died in the firefight, according to officials.
The troops immediately returned to the floor, and using ladders, rescued dozens of people while securing the hotel in a room-by-room search. The siege ended before dawn Sunday, about 11 hours after the first truck exploded.
The twin bombings came two weeks after a truck blast killed at least 358 people at a busy Mogadishu intersection. Somalia’s government blamed al-Shabab for the October 14 attack, although the militant group has not claimed responsibility.