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.


Trump touts $5,000 payout if Republicans win as Vance waits in wings
Search expands after Philippine ferry fire kills five and leaves dozens missing
Trump says Iran war to end after US midterm elections
US military says it struck vessel in Caribbean, killing 3
At least 14 killed in explosion at weapons depot in Syria
US hits five Iranian oil tankers after attack on Navy ships
UK gives air traffic provider a week to probe outage that halted flights
Serbia's President Vucic dissolves parliament, calls snap elections
