Militants stormed a high-end seaside hotel in Mogadishu on Sunday, killing at least 11 people and wounding more than 20.
Taking to Twitter, government spokesman Ismail Mukhtar Omar said the toll includes 11 victims and five assailants.
"Security forces lost one, 18 people were injured," he added.
The gunmen first detonated a car bomb then opened fire with assault rifles in the latest attack in the Somali capital.
Terror group al Shabaab said it was behind the assault on the Elite Hotel in Lido beach.
At about midnight, state news agency SONNA said the operation was over and that 205 people had been rescued, "including ministers, lawmakers and civilians," citing Farhan Qarole, a security forces commander at the hotel.
The hotel is owned by Abdullahi Mohamed Nor, a lawmaker and former finance minister, and is frequented by many government officials and members of the Somali diaspora.
"There were officials of (President Mohamed Abdullahi Farmaajo's) government inside the hotel when we attacked," said a statement broadcast on al Shabaab's Radio Andalus.
The attack follows an uprising at Mogadishu's central prison on Monday. SONNA said at least 15 prisoners and four guards were killed when security forces beat back the rebellion.
"So far we confirmed seven people died, including two attackers, two junior directors and three civilians," information ministry spokesman Ismail Mukhtar Omar told Reuters.
Since 2008, al Shabaab has been fighting to overthrow the internationally-recognised central government and establish its rule.


Five dead at Russian nuclear arms research facility after ammunition explosion
King Charles unveils 'human-centered' AI principles with tech giants
Philippines' Duterte takes the stand in 'politicised' impeachment trial
Hong Kong court finds three guilty of model's gruesome murder
At least 62 killed in Indonesia's Papua riots since Tuesday, police say
India's parliament approves landmark bill to expand legislatures
US senators grill Nvidia CEO over affair with alleged Chinese spy, national security risks
Mexico detains 13 public servants, probes links to organised crime
