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.


8 Israeli airstrikes hit Syria's Abu al-Duhur airbase, state TV reports
Two killed in high school shooting in southern Philippines
Pakistan top court orders ex-PM Imran Khan be moved to hospital from jail
Russian missile attack kills 10 in Ukraine's Kharkiv region, governor says
Trump says Iran won't make deal he thinks is needed
