At least 17 people, including foreigners, were dead, police and an ambulance driver said. Survivors of the attack were led by soldiers from the Pizza House restaurant building. The injured were taken away by ambulances.
The Reuters news agency reports the attack also involved a busy hotel adjacent to the restaurant and puts the death toll at 19 civilians.
Al Qaeda-linked al-Shabab claimed responsibility as the restaurant was under siege.
Soldiers surrounded the building and used guns mounted on the backs of vehicles to attack the militants. Troops entered the ground floor as insurgent snipers held positions upstairs.
All five attackers were killed and soldiers secured the building after dawn, said senior Somali police office Capt. Mohamed Hussein. The troops’ efforts to take control of the Pizza House restaurant were slowed by the darkness of night, forcing them to wait until morning, said Hussein.
Survivors recounted harrowing stories of hiding under tables as armed attackers continued firing in the restaurant and hunted for patrons. Attackers moved from room to room, looking for people, said one survivor.
“I never thought I would have the chance to see the sun again. They were killing people on sight,” Saida Hussein, a university student, told The Associated Press. She said she survived the attack by hiding behind a large table downstairs.
Another survivor, Aden Karie, was wounded by an attacker who spotted him moving behind a curtain in the dark room.
“He shot at me twice and one bullet struck me on the leg,” said Karie as he was taken to a waiting ambulance.
The roofs were blown off the restaurant and nearby buildings by powerful blasts.
The bodies of five girls thought to have been killed by the militants were found in the restaurant, said police. Inside the building, the body of a Syrian man who worked as a chef at restaurant lay near the rubble of a blood-spattered and bullet-marked wall.
The attack began Wednesday evening when a car bomb exploded at the gate to the restaurant, then gunmen posing as military forces stormed the establishment.
An ambulance driver with the Amin Ambulance service, Khalif Dahir, said early Thursday they had carried 17 bodies and 26 wounded people. Most of the victims were young men who had been entering the Pizza House when the vehicle exploded, Hussein said.
The gunmen “were dressed in military uniforms. They forced those fleeing the site to go inside” the restaurant, witness Nur Yasin told The Associated Press.
Wednesday night’s blast largely destroyed the restaurant’s facade and sparked a fire. While al-Shabab claimed to have attacked the neighboring Posh Treats restaurant, which is frequented by the city’s elite and was damaged in the blast, security officials said the Pizza House was targeted instead.
Somalia-based al-Shabab often targets high-profile areas of Mogadishu, including hotels, military checkpoints and areas near the presidential palace. It has vowed to step up attacks after the recently elected government launched a new military offensive against it.
Al-Shabab last year became the deadliest Islamic extremist group in Africa, with more than 4,200 people killed in 2016, according to the Washington-based Africa Center for Strategic Studies.
Somalia President Mohamed Abdullahi Mohamed confirmed that airstrike and said such attacks would disrupt the group’s ability to conduct new attacks.
With a new federal government established, pressure is growing on Somalia’s military to assume full responsibility for the country’s security. The 22,000-strong African Union multinational force, AMISOM, which has been supporting the fragile central government, plans to start withdrawing in 2018 and leave by the end of 2020.
Also Wednesday, the U.N. Security Council unanimously adopted a resolution extending the U.N. political mission in the Horn of Africa nation, which is trying to rebuild after more than two decades as a failed state, until March 31, 2018. The resolution recognized that “this is a critical moment for Somalia.”