A new terrorist threat is brewing in the Sahel, partly as a consequence of the European-sponsored crackdown on migration, according to local leaders in Niger.

Thousands of men who transported, fed, and housed the hundreds of thousands of migrants who used to cross the impoverished west African country are now unemployed and could easily be exploited by one of the major jihadist groups operating in the region, said leaders in the remote former migrant hub of Agadez.

While fewer migrants are dying in the Mediterranean, it is not because Europe is any less popular a destination. Instead the journey’s dangers have been extended further south and far more people are now dying in the desert than before, though they are impossible to count and hidden from European view.

Under pressure from the EU, Niger criminalised migrant smuggling in 2015, and started enforcing the new law 18 months ago. Overnight, about 7,000 people lost what had been a very lucrative legal livelihood. And it became much deadlier for migrants to get to Libya.

“The border with Europe, in reality, is Niger and Chad, taking into account the power vacuum, the chaos there is in Libya,” said Mahamadou Issoufou, the president of Niger. “Whoever holds Africa, holds Europe.”

Facebook Twitter Pinterest A former ‘passeur’ is seen in Agadez. While some have found alternative employment, many remain jobless. Photograph: Tagaza Djibo/The Guardian

The Guardian spoke to Ismail, a driver who spent years taking Africans from the ancient desert city of Agadez up to the Libyan border. Some of his clients – west African citizens who can move freely around their region, much as EU citizens can – were headed to Europe; many others were going to work in Libya and Algeria. Every Monday, a convoy of hundreds of vehicles left Agadez.

But one day, Ismail suddenly became a criminal.

“They have done it to please Europe. They call us criminals, but what crime have we committed?” he asked.

They used to work in the open, but now Ismail and his friends have gone underground, taking circuitous routes through the desert to avoid arrest, plugging into regional trafficking rings and risking 10 years in jail if caught. There are many cases of migrants being abandoned or losing their way in the desert.

There are no reliable figures for the number of people who die on their way through the lawless expanse of desert crisscrossed by traffickers, jihadist groups, and foreign armies.

“Migration has become clandestine,” said Mohamed Anacko, president of the regional council of Agadez. “No one can tell you how many people are still going, or which way. Everyone’s looking at Agadez, so the migrants go round it. Migrants get lost in the desert and nobody knows. They have a breakdown, and it’s months before the bodies are found.”

Ismail has witnessed the perils of such detours at first hand. “It’s much more dangerous than it was, mainly because so many people get lost,” he said in a low voice, his head wrapped in a flowing turban, sweating as evening fell in Agadez. “I see so many corpses in the desert – many more than before. I can’t even count them.”

Business is not as before, but Ismail still has plenty of clients in the “ghettos” – compounds where people wait until they have enough money to pay for the journey.

Souleymane Mazou almost died when his truck driver took fright in the middle of the desert, thinking the police had spotted him, and abandoned all his passengers.

“I sat down and said: ‘If God wants me to die, so be it,’” he said.

Facebook Twitter Pinterest ‘If God wants me to die, so be it’: Souleymane Mazou, second from left, left Togo in search of a better life for his family. Photograph: Tagaza Djibo/The Guardian

Even more people have been dying in the desert in the past seven months, as Algeria is indiscriminately rounding up thousands of people, including some who have lived there for decades, and dumping them on the Nigerien border. This piles further pressure on one of the world’s poorest countries; Niger is already dealing with Boko Haram in the east, the Isis-linked Islamic State in the Greater Sahara in the north-west, and a chaotic Libya to the north.

Anacko warned that if the people of Agadez are not helped to find a new way of making a living, they would join jihadist groups, further destabilising the region and creating an Afghanistan-like situation. He cited the recent discovery of several arms caches buried near the city as evidence of a deteriorating situation.

“The risk we have, with the new law against migration, is if we do nothing for the young men in that industry they’ll fall into extremism,” he said. “All the terrorists come that way, through the desert.

“If we let our young men be won over by them, they’ll take the mountains, and then it’s finished. The day Abu Walid [al-Sahraoui, the leader of ISGS] gets the Aïr mountains, it’s all over. No army in the world could get him out – it will be like in Afghanistan. And those mountains are the terrorists’ objective. Terrorists have made several attempts to get in, but so far the people who live there have refused.”

Ismail, the migrant smuggler, said this would not last long.

“If you have no work, you’re unemployed, and someone comes and offers you millions [of CFA, the local currency], why wouldn’t you follow him?” he asked. “Of course you would. If people are unemployed for years, it’s very easy. Those groups profit from unemployment.”

In a dusty yard in Agadez, men formerly known as “passeurs” – people who work transporting migrants – sat in low chairs, bundled up in yards of cloth and sunglasses and watching as pickup trucks were loaded with rice and oil. They are among the 287 men chosen by an EU-funded organisation to be given a start in another profession – in their case, trading.

Facebook Twitter Pinterest A man walks past water cans in Agadez market. Photograph: Tagaza Djibo/The Guardian

But there are 5,000 others, most of them former rebels who know how to use a gun.

The EU has said it is ready to help those who come up with viable projects, through its €240m (£211m) financial package linked to migration. But Rhissa Feltou, the mayor of Agadez, said progress was slow.

“Many EU projects have been announced, but then there’s silence, so people begin to ask themselves questions,” he said.

And according to Anacko, time is running out. “If Agadez catches fire, the whole Sahel will embrace terrorism,” he said.

Meanwhile, despite the draconian measures to stop them, many migrants continue to risk everything to go north.

Miraculously, just after he sat down to die in the desert, a caravan of nomads on camels saw Souleymane Mazou, gave him water, and called for help.

He survived – just. Now he is preparing to try again, he said, for the sake of the two-year-old daughter he left in Togo. “Whatever the EU or African governments do, it’s not my problem,” he said. “Some people get through. It’s destiny. I’m not scared.”