“IF BEN GUERDANE had been located next to Falluja, we would have liberated Iraq.” So (reportedly) said Abu Musab al-Zarqawi, the leader of al-Qaeda in Iraq, before he was killed a decade ago. He was referring reverentially to a town in south-eastern Tunisia that is one of the world’s biggest exporters of jihadists. No place better epitomises the challenges facing Tunisia’s government as it tries to consolidate a wobbly democracy six years after the revolution that toppled the old dictatorship. Hundreds of Tunisians marked the anniversary of the revolution on January 14th by taking to the streets to demand jobs. The protests began in Ben Guerdane before spreading to other poor places, such as Sidi Bouzid, Meknassi and Gafsa, where locals blocked the route of Beji Caid Essebsi, the president, who was in town to mark the anniversary. “Work is our right,” yelled the protesters, using the slogans of 2011.

Work is indeed a right enshrined in the constitution, adopted in 2014. But the unemployment rate of 16% is higher than it was before the revolution. The rate for youngsters and those in the countryside is higher still. This is partly because a series of terrorist attacks has driven away tourists and foreign investors. Unemployed protesters have blocked roads leading from phosphate mines, further harming export earnings. Past governments have responded by promising to create public-sector jobs. The result is a bloated, unaffordable bureaucracy. A hiring freeze is now in effect.

Disillusioned and aimless, youngsters in rural areas are prime targets of jihadist recruiters. Some 6,000 Tunisians have joined armed groups abroad, with most going to fight in Iraq, Syria and Libya, and some farther afield (see chart). One was Anis Amri, a 24-year-old follower of Islamic State (IS) who drove a lorry into a Christmas market in Berlin, killing 12 people. He was later killed by Italian police.

The government is trying to stem the flow of people joining jihadists abroad. It has closed mosques led by radical preachers and keeps an eye on thousands of young suspects. Tunisians under the age of 35 are not allowed to travel to Libya, Turkey or Serbia, the main transit routes to Iraq and Syria. The borders with Algeria and Libya have been tightened. Parliament has passed an anti-terrorism law, criticised by human-rights groups, that gives the government more power to detain suspects and tap phones, among other things.

In any case, the flow is reversing, with fighters making their way home as the groups they had joined are pushed back. The interior ministry says 800 have already returned. Many fear that some will carry out attacks once back. Indeed, IS has told them to do so and has claimed responsibility for several atrocities in the country. Last March a large group of Tunisian IS members crossed the border from Libya to stage an assault on Ben Guerdane that left dozens dead. Tunisian security forces fear a possible Somalification of the country.

Last month Mr Essebsi played down the threat. But after much criticism, and calls to strip the militants of their citizenship, the government braced up. Youssef Chahed, the prime minister, who belongs to Nidaa Tounes, the main secular political party, has said that returning militants will immediately be arrested. Ennahda, the moderate Islamist party that shares power with Nidaa Tounes, backs this approach, though some blame it for having exacerbated the problem by previously indulging radical preachers. “We have all the details on [the returnees],” says Mr Chahed. “We know them one by one.” But many probably left the country and came back without passing through customs. Moreover, the grievances that prompted so many to become jihadists have not yet been dealt with. In places like Ben Guerdane locals still feel that the government does not care very much about them.