MOGADISHU — A gun battle that raged for nearly 20 hours in the capital of Somalia as soldiers battled to dislodge Islamist militants holed up in a building next to a hotel they had bombed ended on Friday with all of the attackers killed, the police said.
The militants, from the Shabab extremist group, set off two car bombs on Thursday: one outside the Hotel Makkah al-Mukarammah on a busy street in Mogadishu where Somalis were dining at restaurants, and another near the home of Appeals Court Chief Judge Abshir Omar.
The blasts and shooting killed at least 29 people and injured 80 others; officials said the toll was expected to rise.
After the explosions, the attackers retreated to an adjacent building from where they fired on soldiers who tried to enter. A police captain, Mohamed Hussein, told The Associated Press that two of the dead were soldiers.
The attack was the latest in a series of high-profile assaults in East Africa by the Shabab, Africa’s deadliest Islamic extremist group, which claimed responsibility for the attack and said it had targeted the hotel, which is patronized by government officials.
The gunmen opened fire on nearby businesses, and dozens of cars caught fire. Images and video footage shared online showed the blown-out walls of a building where the militants were believed to have taken refuge. Buildings nearby were left with extensive damage, and destroyed vehicles stood in the street.
The militants were “fighting back with grenades” and Kalashnikov rifles, a police officer, Maj. Musa Ali, told Reuters. “So far we know 29 people, mostly civilians died, and 80 others injured,” he said, adding that many civilians had been rescued but that the death toll could rise.
Another police officer, Maj. Mohamed Hussein, said: “It was very difficult for the security forces to enter the building last night because it is dark and electricity was cut by the blast. Now it is daybreak, and we hope the operation will be concluded in the following hours.”
A spokesman for the Shabab, Abdiasis Abu Musa, had said, “The government tried three times to enter the building, but we repulsed them.”
security forces who worked well into Friday to rescue trapped civilians. The police said more than 10 people had been freed since morning, according to The A.P.
Many victims of Thursday’s attack suffered horrific wounds, and hospitals were said to be struggling to cope with the casualties, The Associated Press said. Some of the wounded had lost limbs, Sadiya Yusuf, a nurse at Daru al-Shifa hospital, told The A.P.
The attack came after American forces in Somalia stepped up airstrikes against the Islamist group. On Friday, The United States Africa Command said airstrikes targeting the Shabab near Hiran, Somalia, on Thursday had killed an estimated 26 militants.
Somalia has been convulsed by lawlessness and violence since 1991. The Shabab are fighting to dislodge a Western-backed government protected by African Union-mandated peacekeepers. The group wants to impose Shariah law in the country.
The Shabab have also carried out deadly attacks in neighboring countries, including one on a hotel and office complex in Kenya in January that killed 21 people.
The main street in Mogadishu where the blast occurred was closed on Friday. Witnesses said they had seen frantic residents searching for missing relatives through the night.
“I have been running to and fro from blast scene to hospitals since yesterday evening in search of my husband and brother who were selling a shop at the place where the blast took place,” said Halima Omar, a mother of three.
“I have just seen them in hospital; they are in critical conditions,” she added. “My husband lost his stomach and my brother suffered severe wounds to both arms.”
In 2015, militants stormed the popular Sahafi Hotel in the heart of Mogadishu, blowing up the front gate with a car bomb, shooting guests and hotel workers, and then battling with security forces from the hotel’s rooftop for several hours. At least 14 people were killed in the attack.
In 2016, at least 14 civilians were killed and dozens were wounded after Islamist militants struck a popular beachside restaurant in Somalia’s capital.
The United States has drastically increased airstrikes against the Shabab since Donald J. Trump became president. The American military command for Africa reported carrying out 50 strikes in Somalia in 2018.
This year, American strikes targeting Shabab fighters have come at an even faster pace. The military command in Africa reported 23 as of Tuesday, including one in central Somalia that killed 20 militants, and another the day before that killed 35.