"The operation is over now and the gunmen were killed by the security forces," said Mohamed Ahmed Arab, spokesman for Somalia's security ministry.
"They have attacked business places and killed innocent civilians: 18 civilians were killed, including a Syrian national, and more than 10 others were wounded," he said.
The attack began at around 8pm (1700GMT) on Wednesday evening with a suicide car bombing at the Posh Treats restaurant and club, after which gunmen stormed inside the nearby Pizza House restaurant.
The gunmen spent the night roaming the restaurant killing those they found trapped before they were eventually killed by the security forces.
Get Breaking news, live coverage, and Latest News from India and around the world on NDTV.com. Catch all the Live TV action on NDTV 24x7 and NDTV India. Like us on Facebook or follow us on Twitter and Instagram for latest news and live news updates.