Al-Shabab militants disguised as soldiers attacked two restaurants popular with Somalia's upper crust on Wednesday night.

A suicide car bombing hit the Posh Treats restaurant and club in the Zobe area of Mogadishu at about 8 p.m. local time. Shortly after militants stormed the neighboring Pizza House restaurant and seized about 20 hostages.

The gunmen reportedly spent the night seeking out people still hiding at the venue and shooting them. Government soldiers responded by shooting the gunmen dead.

By Thursday morning at least 18 had been killed, a government spokesman said.

Read: Is Islamic extremism on the rise in Africa?

Read: Seven terror organizations making headlines

Popular with affluent elite

Both venues were popular with affluent, young and diaspora Somalis and were busy as customers broke the Ramadan fast in the predominantly Sunni Muslim nation. In 2015 The Guardian newspaper described Posh Treats as the first country club open in the city after more than two decades of war. It reportedly housed a restaurant, spa, en-suite guest rooms, a gym, a shisha spot and a snooker table. In 2016 Bloomberg described Pizza House as a relatively expensive three-story eatery with a movie theater and views over the Indian Ocean.

"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 Thursday.

Vehicle-mounted guns

Government soldiers surrounded the restaurant and used vehicle-mounted guns to kill the militants. The soldiers stormed the ground floor as insurgent snipers held positions upstairs.

But military efforts to regain control of the Pizza House restaurant were slowed by the darkness of night, forcing soldiers to wait until morning, Police Captain Mohamed Hussein said. All five attackers were killed, and after dawn the soldiers secured the building, he said.

Attackers had cut off electricity to complicate security forces' efforts to end the siege, Hussein said earlier.

Survivors hid

Survivors said they hid under tables as armed attackers kept firing in the restaurant and hunted for patrons. Attackers moved from room to room, looking for people, according to one person.

"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 survived by hiding behind a large table.

Another survivor, Aden Karie, said he 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," Karie told AP as he was taken to a waiting ambulance.

Police found the bodies of five girls likely killed by the militants in the restaurant. The body of a Syrian chef lay near the rubble of a wall.

An ambulance driver with the Amin Ambulance service said they had carried 17 bodies and 26 wounded people.

Witness Nur Yasin told AP that the gunmen "were dressed in military uniforms. They forced those fleeing the site to go inside" the restaurant.

Al-Shabab campaign

Al-Shabab, which claimed responsibility during the attack, was the deadliest Islamic extremist group in Africa last year, killing more than 4,200 people, according to the Washington-based Africa Center for Strategic Studies.

The group often attacks high-profile areas of Mogadishu, including hotels, military checkpoints and areas near the presidential palace.

Al-Shabab vowed to step up attacks after the recently elected government launched a new military offensive against it. US President Donald Trump also approved expanded operations, including airstrikes, against Al-Shabab. On Sunday, the US military reported that it killed eight Islamic extremists in an airstrike on a rebel command and logistics camp in the country's south.