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.


US war in Iran has cost $29 billion so far, Pentagon says
At Temple of Heaven summit, Trump and Xi will seek a good harvest
Peace deal hopes fade after Trump rejects Iran proposal
Protests erupt after key college entrance test cancelled in India
UK's Starmer defies calls to quit, says he is getting on with governing
New Israeli law sets military tribunal for those linked to October 7 attack
Russia strikes Ukraine with drones as ceasefire ends
Dutch hospital quarantines 12 over breach of hantavirus protocol
