"We have counted around nine of the attackers who have been killed by the security forces and five Somali officials, among them soldiers," Somali police official Abdirahman Mohamed said.
Al-Qaeda-linked Shebab rebels immediately claimed responsibility for the attack.
Militants exploded a huge car bomb at the perimeter of the central Mogadishu complex, and around a dozen suicide attackers breached the Villa Somalia compound.
The UN's special envoy to Somalia said the country's president, Hassan Sheikh Mohamud, had telephoned to say he was unharmed in the attack against the complex, one of the best-defended locations in the war-torn country.
"Desperate violent terrorists have staged a failed attack," National Security Minister Abdikarim Hussein Guled told reporters, as the complex was sealed off by Somali troops and soldiers from AMISOM, the African Union force fighting the Shebab.
"Things are back to normal and the security forces are in full control of the situation," he said.
A military spokesman for Shebab told AFP that the group was behind the attack.
The group, who also carried last year's attack against the Westgate shopping mall in the Kenyan capital, once controlled most of southern and central Somalia but withdrew from fixed positions in the ruined coastal capital two years ago.
You’ve reached your limit of {{free_limit}} free articles this month.
Subscribe now for unlimited access.
Already subscribed? Log in
Subscribe to read the full story →
Smart Quarterly
₹900
3 Months
₹300/Month
Smart Essential
₹2,700
1 Year
₹225/Month
Super Saver
₹3,900
2 Years
₹162/Month
Renews automatically, cancel anytime
Here’s what’s included in our digital subscription plans
Exclusive premium stories online
Over 30 premium stories daily, handpicked by our editors


Complimentary Access to The New York Times
News, Games, Cooking, Audio, Wirecutter & The Athletic
Business Standard Epaper
Digital replica of our daily newspaper — with options to read, save, and share


Curated Newsletters
Insights on markets, finance, politics, tech, and more delivered to your inbox
Market Analysis & Investment Insights
In-depth market analysis & insights with access to The Smart Investor


Archives
Repository of articles and publications dating back to 1997
Ad-free Reading
Uninterrupted reading experience with no advertisements


Seamless Access Across All Devices
Access Business Standard across devices — mobile, tablet, or PC, via web or app
