Paris - Already wrestling with a constantly-evolving terror threat, European intelligence agencies spy a new problem on the horizon: hundreds of jihadists due to be released from prison.
Battling to stop further attacks like those seen everywhere from London to Paris, Brussels to Barcelona, freshly-released prisoners will add to agencies' surveillance burden.
Although many may go on to lead peaceful lives after prison, some may not -- and officials admit they have so far given insufficient attention to working out the scale of the threat.
They are already working to keep track of jihadists returning from the battlefield in Iraq and Syria, and homegrown radicals who investigators fear could launch an attack at any moment.
In France alone, some 500 jihadists handed heavy jail sentences at the beginning of the 2000s are set to be released before 2020 after serving their time, an anti-terror official told AFP.
"They represent a potential threat, a worrying threat that we are taking very seriously," said the official, speaking on condition of anonymity.
- Prison, a 'school for jihad' -
Some 1,500 other French prisoners are suspected to have been radicalised behind bars, not least thanks to contact with these hardened extremists.
One of the most infamous examples of authorities losing track of a released jihadist is that of Cherif Kouachi, who along with his brother massacred staff at Charlie Hebdo magazine in Paris in 2015.
Major Islamist attacks in Europe
Imprisoned from 2005-2006 awaiting trial for his role in a recruitment network that sent jihadists to Iraq, he was convicted in 2008 but walked free as he had already served his time.
Kouchai was placed under surveillance and his phone was tapped for several years, but he and his brother Said threw investigators off the scent by using their friends' phones.
Before they attacked Charlie Hebdo in 2015, killing 12 in a hail of Kalashnikov bullets, they had slipped off the radar simply by moving house.
Anti-terror officials agree that the same mistakes must not be made again.
"We have to have the same attitude towards those leaving prison as we do towards those coming back from Syria," said Yves Trotignon, a former anti-terror analyst at French foreign intelligence agency DGSE.
- Continuity in intelligence work -
"For these 500 guys that are going to be coming out, we have no means of evaluating the operational danger they represent," said Trotignon.
"The only solution is to immediately start following their networks. Who is meeting who? Who is telephoning who? In this way you can start to map out their contacts."
He added: "We often say that prison is a school for crime, but it's also a school for jihad.
"It's the place where those on the fringes get radicalised, where they learn things from those detained earlier."
Britain has some 200 people in prison on terrorism offences as of December, according to interior ministry figures, a number that has been steadily rising in recent years.
And Belgium is wrestling with a similar problem.
Islamic expert Alain Grignard of Liege University said up to 200 people had been sentenced on terror charges before and after the 2016 Brussels attacks, and at some point they will walk free.
"Rarely do people come out of prison better than when they went in," he warned.
"Even more so for someone who is idealistic who, as well as a criminal past, has this dimension of a fight against injustice in which Muslims are the victims," he added.
"They can come out even more motivated than before."
Dutch lawyer Andre Seebregts, who has defended several suspected jihadists recently released from jail, said none of his clients had been offered any formal rehabilitation.
Such convicts are often tracked with GPS ankle bracelets and given contact with a government-provided imam and parole officer.
But "the danger of re-radicalisation is still there," he told AFP.
Extremists may be carefully surveilled before their arrest but then go on to inhabit what one French penitentiary official called an "intelligence blind spot" once behind bars.
"After the attacks of 2015 and 2016, this is no longer acceptable," the official said.
French authorities last year gave the prison intelligence agency BCRP boosted powers, and they are increasingly using surveillance techniques previously reserved for police.
Across Europe, the goal is now to try to maintain as much continuity as possible when it comes to tracking jihadists in prison and afterwards.
But a senior French anti-terror official pointed out that permanent surveillance of all radicalised prisoners is out of the question.
"Tailing a suspect 24/7 takes 20 or 30 cops," he said. "You do the math."
By Michel Moutot