Residents look at the damage at the site of an explosion in the center of Mogadishu. (Mohamed Abdiwahab/AFP/Getty Images)

The death toll from two truck bombs in Somalia's capital soared to as many as 276 on Sunday as the deadliest attack in the country's decade-long war with Islamist extremists signaled that the insurgency is far from defeated despite years of U.S. counterterrorism operations.

Nearly all of the dead were killed by the first bomb, which exploded Saturday outside a popular hotel near a busy intersection in Mogadishu, sending a plume of smoke into the sky that could be seen across the city. The second truck bomb killed several more people nearby.

The Somali capital is a frequent target of attacks by al-Shabab, an extremist group linked to al-Qaeda, but residents said they quickly discerned that the twin blasts were of a different order of magnitude.

The death toll continued to climb overnight. By Sunday night, officials said they were still trying to calculate the number of victims. In a radio address, the mayor of Mogadishu, Thabit Abdi, said, "We have lost more than 240 innocent people." Somalia's information minister said the death toll had risen to 276, the Associated Press reported.

A large swath of a city block appeared wiped out, and a tower of charred automobiles could be seen at the bombing site. A BBC reporter said people were trapped under the rubble of the Safari Hotel. Throughout Sunday, bodies were carried from the rubble.

[Exclusive: U.S.-funded Somali intelligence agency has been using kids as spies]

Somalia's president, Mohamed Abdullahi Mohamed, declared three days of national mourning. The government blamed the carnage on al-Shabab, but the group has not claimed responsibility.

"Today's horrific attack proves our enemy would stop at nothing to cause our people pain and suffering. Let's unite against terror," Mohamed said on Twitter.

Medical workers spoke about the scale of the attack, which quickly overwhelmed the city's few hospitals.

"Today is the worst day of my life. We are overwhelmed by the high number of the casualties. I have been working at this hospital for more than seven years, and I never saw or heard this number of deaths,'' said Ahmed Osman, a nurse in Mogadishu's Medina Hospital, where many of the dead and wounded were taken.

The International Federation of Red Cross and Red Crescent Societies said five of its volunteers were among the dead. One volunteer who survived, Abdiasis Mohamed, said he and his friends were drinking tea when one of the bombs exploded. When he regained consciousness, he said, he was covered in blood and several of his friends had been "burned to death."

"Thank God I am fine," he said.

Two of Hawo Ahmed's sons, both shopkeepers, were killed.

"They came home for lunch, and we had lunch together," she said. "They were innocent and the breadwinners for my family."

Last year, she said, her husband was killed in an attack.

[The U.N. asked for billions to avert four hunger crises. The money didn’t arrive.]

Somalia has been battling al-Shabab insurgents since 2007, with the help of 22,000 troops from the African Union and a U.S. counterterrorism campaign that has expanded under President Trump.

For years, drone strikes were the centerpiece of the U.S. military strategy, carried out with the expectation that the militant group would dissolve if its leadership was vanquished. That has not happened.

Although the U.S. and African Union operations forced insurgents from territory they once controlled, they have not curbed al-Shabab's ability to launch deadly and frequent attacks in Mogadishu, mostly targeting restaurants, hotels and places where officials gather.

Earlier this year, the White House loosened the rules governing U.S. operations in the country, declaring parts of Somalia to be an "area of active hostilities."

A one-star general was assigned to coordinate operations from a compound within Mogadishu's airport. The small, elite teams of U.S. Special Operations forces in Somalia were augmented with conventional Army troops who provide a variety of training for the Somali forces.

The Pentagon refuses to say precisely how many Americans are deployed to Somalia — believed to be a few hundred at most — but Defense Secretary Jim Mattis indicated earlier this year that the Trump administration would consider sending more personnel if asked by the Somali president.

It's unlikely, though, that the weekend's attack will result in any substantial American military buildup. As in other unstable parts of Africa, the U.S. strategy in Somalia has been to support allied forces by sharing intelligence, providing training and equipment, and conducting precision airstrikes — but not doing the fighting for them.

Mattis has characterized the objective in Somalia as "buying time" for the Somali government to assemble its own security forces. Still, the mission there remains dangerous. In May, a Navy SEAL was killed and two other U.S. commandos were wounded during a battle with militants west of Mogadishu. It marked the first U.S. combat death in Somalia since the early 1990s.

A number of officials were killed in Saturday's attack, including Mohamoud Elmi, the director general at the Ministry of Humanitarian Affairs.

In 2016, al-Shabab was the deadliest terrorist group in Africa, according to the Armed Conflict Location and Event Dataset, killing 4,281 people.

Somalia has struggled to maintain a stable government or a defense force capable of challenging the Islamist militants. Last week, both the defense minister and the army chief resigned for reasons that remain unclear. Many analysts argue that Somalia's undeveloped security sector has made it easy for al-Shabab to penetrate the country's largest city with thousands of pounds of explosives.

Earlier this year, the country teetered on the brink of famine, in large part because of the fighting's effect on agriculture and the distribution of humanitarian aid.

In the wake of Saturday's attacks, one Mogadishu ambulance service underscored the scale of the bloodshed.

"In our 10 year experience as the first responder in Mogadishu, we haven't seen anything like this," Aamin Ambulance said on Twitter.

In a statement, the U.S. Mission to Somalia called the bombings "cowardly attacks" that "reinvigorate the commitment of the United States to assist our Somali and African Union partners to combat the scourge of terrorism."

As rescue teams continued their work at the site of the bombing, residents of Mogadishu took to the streets to protest al-Shabab, shouting, "We don't want bloodthirsty elements."

Mire reported from Mogadishu. Andrew deGrandpre in Washington contributed to this report.

Read more:

For 5,000 Somali refugees, a Canadian college scholarship offers a way out

Al-Shabab militants storm army base in Somalia, killing dozens

Expectations run high for Somalia’s new president

Today’s coverage from Post correspondents around the world

Like Washington Post World on Facebook and stay updated on foreign news