However, according to witnesses, the young Somalis killed were not part of the security services but were students hoping for scholarships to Sudan and Turkey .

On Tuesday, many students and their families had gathered at the government compound, located near a busy intersection, to check bulletin boards with the results of examinations.

“Several students I knew were killed in the blast,” said Anisa Abdulle, a 16-year-old student who visited the compound earlier but left before the blast. “This is horrible. I hate the Shabab, because they see the students going for learning as enemies.”

Photo

According to witnesses, around 10:45 a.m., a 15-ton truck loaded with fuel drums pulled up to the entrance of the compound, which houses various government ministries, including those dealing with education, foreign affairs and labor issues. Another fuel truck was passing by, and Ali Mohamed, a bystander, said the driver of the truck filled with explosives chose that moment to detonate them.

“But we are lucky; the oil tanker passing by did not explode,” Mr. Ali said.

Still, he said, “This is the most horrific incident I have ever witnessed.”

Newsletter Sign Up Continue reading the main story Please verify you're not a robot by clicking the box. Invalid email address. Please re-enter. You must select a newsletter to subscribe to. Sign Up You will receive emails containing news content , updates and promotions from The New York Times. You may opt-out at any time. You agree to receive occasional updates and special offers for The New York Times's products and services. Thank you for subscribing. An error has occurred. Please try again later. View all New York Times newsletters.

The explosion sent a gigantic fireball into the sky and shattered windows for miles around. It spewed bodies across an area several city blocks wide. Many were small and thin and appeared to be children, charred beyond recognition. Somali government officials said no senior officials were hurt.

The Shabab introduced suicide bombs to Somalia, and since Shabab fighters began their insurgency in 2007, they have struck many times, with victims including Somali lawmakers, African Union peacekeepers and poor women sweeping up Mogadishu’s bullet-pocked streets.

But few, if any, of their attacks have killed as many people as the one on Tuesday.

There had been hopes that the Shabab’s withdrawal from Mogadishu would usher in a new era of stability, at least in the capital. For the first time in years, the transitional government, backed by 9,000 African Union peacekeepers, was nominally in control. Certain areas, including the area near the stricken government compound, were considered relatively safe, and in recent months, traders had returned to streets pulsing with more life than there had been for a long time.

Video

Many analysts were even going so far as to say that the Shabab were a spent force, racked by internal divisions and dwindling resources. In recent months, the Shabab have suffered heavy losses in Mogadishu, and Shabab fighters have been pushed out of areas along the Kenya and Ethiopia borders by militias that are covertly backed by Kenya and Ethiopia. American drone strikes have also killed several Shabab operatives, and in June, the top Qaeda agent in Somalia, Fazul Abdullah Mohammed , was killed in a somewhat random shootout in Mogadishu.

Advertisement Continue reading the main story

But in the past week or so, the Shabab seemed to be regrouping. On Friday, hundreds of Shabab fighters poured into Dhobley, a market town on the Kenya border, setting off an intense battle. The Shabab briefly occupied the town before a Kenya-backed militia was able to push them out. Then on Monday, the Shabab struck a town in central Somalia, Dhusamareb, withdrawing after inflicting casualties.

Despite the millions of dollars pumped into it, Somalia’s transitional government is still weak and divided, and the Shabab control most of southern Somalia, imposing draconian measures in its areas, banning music , Western dress and even bras, calling them all un-Islamic. Last month, Shabab leaders awarded schoolchildren assault rifles and grenades as prizes for a quiz show.

The Shabab are also widely blamed for causing Somalia’s famine. Much of the Horn of Africa, including Kenya, Ethiopia and other parts of Somalia, has been hit this year by one of the worst droughts in decades. But just about the only areas where that drought has spelled famine, as defined by certain thresholds of death and malnutrition rates, are Shabab-controlled areas.

The Shabab have refused to allow many Western aid organizations into their territory and have even blocked famine victims from fleeing to seek help.

The United Nations says that tens of thousands of people have already died and that as many as 750,000 may soon starve to death unless aid efforts are rapidly scaled up.