THERE was a rare moment this week in Somalia's capital, Mogadishu, when a crowd of protesters marched through the ruined seaside city and burned the black flag of the Shabab, the jihadist militia that is threatening to take over the country. The Shabab, which means youth, hunts down its critics, sometimes beheading them, so torching its battle banner in broad daylight was a brave act. But the courage was perhaps born of desolation. Most of the protesters were family and friends of Benadir University medical students killed by a suicide-bomber on December 3rd.

It has been 18 years since Somalia has had a properly functioning government. Since 2007, 19,000 Somali civilians are reported to have been killed and 1.5m displaced; over 3m in a population of 8m need emergency aid. Yet amid all the violence and despair, people often overlook the lion-hearted efforts of institutions like Benadir University to turn the country around. Against the odds, the embattled university trains young Somalis to serve as doctors in Mogadishu's dire hospitals.

A graduation ceremony for its newest physicians was meant to be a moment of celebration. It took place in a hotel in the only part of the city that Somalia's feeble transitional government still controls; several government ministers were present. Survivors say the bomber was a man dressed in a burqa. He approached the students and blew himself up, killing at least 22 people, many of them just-qualified doctors, and injuring 60. Three ministers perished; a fourth was badly wounded. So cruel was the attack that even the Shabab did not dare claim responsibility.

The bodies of the dead ministers wrapped in blue and white Somali flags have stirred an uncommon wave of national feeling in a normally bitterly fractious society. Some hope the bombing may even mark the beginning of the end for the jihadists.

But that is unlikely. The Shabab controls most of south and central Somalia. If anything, its area of operations is widening. The Shabab covers its expenses from taxes, tariffs and roadblocks. It includes some opportunists but at its core are ferocious fighters linked to al-Qaeda who are intent on creating a caliphate of Greater Somalia, including chunks of Ethiopia and Kenya. The Shabab appears to run at least two suicide-bomb brigades, mostly made up of teenage boys. The bomber at Benadir University may have been one of them.

The death of the ministers is a big blow to a government already struggling to keep its less stoical ministers and parliamentarians in the country. The well-meaning president, Sharif Ahmed, a moderate Islamist who was once a geography teacher, has been ineffectual. His more secular-minded prime minister, Omar Sharmarke, whose father was an assassinated president of Somalia, says he wants more help to train his country's army and police. He also wants a massive programme of apprenticeships for young unemployed Somalis. International navies, he says, should not just chase pirates but should also protect Somali waters from illegal fishing.

Outsiders seem unable to hold the ring. The African Union (AU) still has a force of around 5,000 peacekeepers, mostly from Uganda and Burundi, 17 of whom were killed by a Shabab suicide-bomber in September. But the AU force cannot patrol freely beyond a few streets in one section of Mogadishu. America has been sending arms and money. European countries have pledged support—but not nearly enough to defeat the Shabab.

Somalia's neighbours, especially Kenya, are increasingly worried. Shabab commanders controlling south Somalia say they will not spread their jihad across the border provided the Kenyan army leaves them alone. Yet for decades many Kenyan ethnic Somalis, whose territory covers a swathe of north-eastern Kenya, have hankered after joining their brethren. Western intelligence people in Nairobi, Kenya's capital, have long feared that Somali jihadists will spread their wings into neighbouring countries or even farther afield.