When Streatham attacker Sudesh Amman ran out of a high-street shop and began indiscriminately stabbing passersby last weekend, Aimen Dean worried that his prediction was coming true. A former al-Qaeda member turned MI6 spy, Dean had told me days beforehand of his certainty that the next big terror threat to civilian life was offenders leaving prison.

“They could form the next wave of lone wolf attacks in the UK,” said Dean, just over a week before the incident in south London. “It’s a problem we’re facing right now.”

Dean’s fears weren’t unfounded – it was the second such attack in as many months, following Usman Khan’s fatal stabbing of two people at an offender rehabilitation conference near London Bridge. In the wake of the attacks, the Government has announced plans to increase prison sentences for people convicted of terrorism offences, and has said it will introduce emergency legislation to prevent their early release. But new data shows demand for prison spaces will outstrip supply by 2022.

“The dangerous message Amman and Khan have sent is that if you’re a convicted terrorist, you either go out in a blaze of glory or you’re watched for your whole life,” says Dean. The release of more such convicts in coming months and years means, he warns, that “the appeal of this kind of atrocity will intensify” – here and across France, Germany, the US, Canada and Australia, where prosecutions for terrorism-related offences are highest.

When we meet in January, 41-year-old Dean speaks rapidly and with authority on subjects from Islamic history to deradicalisation. On the latter, he is well versed, having undergone “a very strange career progression from trainee Imam, to jihadist, to terrorist bombmaker, to spy, to banker” – as well as host of Conflicted, a podcast about the Middle East, which returns for a second series this week.