ON JUNE 14th the Sultan of Aïr, the traditional leader of the Touareg people of Agadez, came out to pray. It was a grand spectacle. Thousands had gathered to mark the end of the Muslim fasting month of Ramadan at a huge open ground. When the Sultan had finished praying, he rode back to his palace, flanked by nobles on horseback and tootling trumpeters. In the streets everyone was smiling and waving. It must have been a relief for the Sultan: a few blessed hours of not having to listen to his subjects moaning about the collapse of the people-smuggling trade.

For centuries Agadez, home to perhaps 200,000 people, has lived off trans-Saharan commerce. Once camel trains set off from here with slaves, pilgrims, salt and gold. More recently it has prospered from a boom in the traffic of people north across the sands to the Mediterranean and onward to Europe. Many Europeans think of this flow of people as a vast, terrifying flood. It has prompted Italy to close its ports to rescue ships, and almost led to the collapse of Germany’s governing coalition this week. Yet as anyone in Agadez will tell you, it has now dried to a trickle.

Over the past four years some 600,000 people are thought to have crossed the sea from Libya to Italy. Most of those probably reached Libya via Agadez, crossing Niger at a rate of about 100,000 a year on average since 2000, reckon researchers at the Clingendael Netherlands Institute of International Relations. After the fall in 2011 of Muammar Qaddafi, Libya’s late dictator, the numbers crossing shot up, peaking at 330,000 in 2016. Now the number making their way north from Agadez could be fewer than 1,000 a month.

This is largely because of bigger efforts to restrict migration through Niger. The European Union (EU) has pressed the Nigérien government to stanch the flow. Its own people have demanded action, too, after the deaths in 2013 of 92 Nigériens, mostly women and children, who had been dumped in the desert by smugglers. In 2015 Niger passed an anti-trafficking law. In 2016 it began seriously to enforce it. Drivers carrying migrants north were jailed and their cars were confiscated. In return the EU has stepped up aid to Niger. Rhissa Feltou, the mayor of Agadez, says that, in effect, the Nigérien police checkpoint outside the town has become the new southern frontier of the EU. And with it has come hardship for his town.

At the peak of the migrant boom some 6,000 people were directly employed in ferrying people north or providing food and lodging on the way, according to the Dutch study. In addition, young men earned a living driving motorcycle taxis that ferried migrants around town as they bought food, water, turbans and sunglasses for the desert crossing. Indirectly one in two households in Agadez benefited. Since the slump bus companies have fired 75% of the staff who worked on the route from Niamey, the capital, to Agadez.

The flow has not halted completely. But migrating has become more dangerous, and more expensive. Officials demand bigger bribes to look the other way. Smugglers avoid the main road, which is so infested with bandits that traders move in convoys, escorted by the army. The crackdown has made people-traffickers nervous. When they think they are about to be caught by the police or army, they abandon their passengers in the desert to avoid being prosecuted and losing their trucks. The International Organisation for Migration (IOM) has rescued 8,255 people stranded in the desert since August 2016. Many more are doubtless never found. Goge Maimouna Gazobi, the head of Niger’s anti-trafficking agency, insists that stricter enforcement has reduced the number of people being left in the desert, because fewer set out in the first place. No one knows for sure.

Although the number of people heading north from Agadez has plunged, a few thousand each month pass through in the other direction, having failed to make it to Europe. Some of those now being cared for in IOM transit centres report that lawless militias in Libya are kidnapping migrants and holding them for ransom.

Many of those who flow back south do so indirectly. After being blocked in Libya thousands of migrants have gone to Algeria, hoping to find work, or to Morocco, hoping to find an alternative route to Europe. But Algeria is ever less welcoming. It is “vomiting” migrants into Niger, says Alessandra Morelli of the UNHCR.

Since 2014 Algeria has deported 31,697 Nigériens. Recently it has also been illegally deporting citizens of other west African states to Niger. Typically people are arrested on the street and not allowed to collect their belongings, savings or sometimes even children before being loaded onto lorries. Since September more than 13,000 people have been discarded in the desert several hours’ walk from the Nigérien border post. When they straggle across the IOM puts them on buses to Agadez, where they join a hotch-potch of nationalities who have come here via circuitous routes.

Among these are some 2,000 Sudanese from Darfur, most of whom had gone to Libya before being sent back south to Agadez. Hundreds now live on the streets. Elsewhere in Niger the UN is caring for almost 58,000 Malian refugees and more than 250,000 people displaced by Boko Haram, a jihadist group in Nigeria, or by fighting in Niger near the border with Mali.

Mr Feltou, the mayor, says that “extraordinary resilience” is part of the Agadez tradition. That is evident in how the city’s inhabitants are finding profit in other smuggling ventures. Entrepreneurs now buy cheap or stolen cars from Libya and drive them to customers across west Africa. Drugs and guns are also flowing across the Sahara via Agadez. Ibrahim, a petrol-station manager, says that each of those involved in smuggling migrants “supported five families”. Now they are looking for another way to make a living.