The Jazeera Palace Hotel, close to both Mogadishu’s airport and a United Nations compound, was heavily guarded and had been considered one of the safer places in the city, despite previous attacks. But on Sunday afternoon, a suicide bomber, driving on Airport Road, got to within about 100 feet of it before triggering a thunderous blast that ravaged the hotel and sent smoke billowing skyward.
The Shabab, an Islamist extremist group, claimed responsibility for the bombing, saying it was in retaliation for the killing of civilians during a recent offensive by Somali and African Union troops against Shabab forces in the southern part of the country.
Most of the people known to have been killed or wounded were pedestrians or motorists. It was not immediately clear if the bombing, which also destroyed several neighboring houses, had caused injuries or deaths inside the hotel.
A man who lives near the hotel said he was watching television when the blast occurred.
“Once the explosion happened, I saw myself laying on the ground and the television set as I was watching broke apart onto the ground,” said the man, who asked not to be identified because he feared for his safety.
Another resident said he had seen at least 10 bodies. Hotel employees said on Sunday evening that at least three of its guards were among the dead.
Mohamed Abdikarim, a journalist with Universal TV, a Somali network that has its headquarters in London, was killed in the attack, and a colleague, Salmaan Jamaal, was wounded. They had been in a car on Airport Road, according to Abdullahi Hersi, the East Africa director of Universal TV.
“We will miss Mohamed,” Mr. Hersi said. “He was our correspondent in the Gedo region and was on a business trip to Mogadishu.”
Photographs from the scene showed the hotel in ruins. It housed several embassies, including those of Qatar, Egypt and China.
In a statement, Somalia’s president, Hassan Sheikh Mohamud, strongly condemned the bombing, which he called a terrorist attack.
“The terrorists want to obstruct the people’s choice to live in peace, which will never happen,” he added.
The recent African Union and Somali campaign against the Shabab seized two strategic towns, Bardera in the Gedo region and Dinsoor in the Bay region, as well as several villages. The offensive unfolded shortly before President Obama’s visit to East Africa.
In his statement, Mr. Mohamud said that those defeats had led the militants to attack civilians.
In January 2014, the police beat back an assault on the hotel by armed gunmen and suicide bombers. In September 2012, suicide bombers tried to assassinate Mr. Mohamud at the hotel shortly after his election.
The Shabab also claimed responsibility for the killing of a lawmaker in Mogadishu on Saturday.