The courses Khan attended have not been fully evaluated, so their effectiveness is unknown. “I think we have to be very careful about saying someone has totally changed or has been cured,” the designer of one of them, Christopher Dean, said after the attack. Prime Minister Boris Johnson’s view on deradicalization is perhaps too bleak—he told reporters after last weekend’s stabbings that “the instances of success are really very few”—but the programs are resource-intensive, and Britain’s poorly funded prisons are badly equipped to provide them.

The standard program involves multiple counseling sessions that encourage offenders to rethink their identity. The aim is not simply to provide inmates with an alternative, nonviolent version of their religion—Snell, who interviewed suspected terrorist detainees in Iraq, told me it was remarkable “how little your average Islamist knows about Islam.” The men, who had come from Tunisia, Saudi Arabia, and other countries, talked more like students taking a gap year than religious fanatics. “They almost universally were young men without much sense of direction or status, and by joining the insurgency in Iraq, they felt for the first time in their lives that they mattered, that they were doing something important, almost heroic,” he said. “So basically, it’s a mental health issue.”

Read: I wrote to John Walker Lindh. He wrote back.

The first part of deradicalization, then, is understanding individuals’ psychological state, previous trauma, and personal circumstances—not just their political and religious beliefs. “We used to work with a group who worked in U.K. prisons,” Moustafa Ayad, a deputy director at the Institute for Strategic Dialogue, an international think tank, told me. “The way they described it was ‘deconstructing the terrorist and rebuilding the human.’ It’s not anything that’s set and planned.”

One of the hallmarks of a terrorist worldview is its rigidity: us and them, the righteous and the unbelievers. Cracking that is key to deradicalization, according to Rashad Ali, a former member of Hizb al-Tahrir, an Islamist group that Britain has repeatedly considered banning. Ali, now a senior fellow at the Institute for Strategic Dialogue, told me that creating a “cognitive opening” to allow people to reevaluate their beliefs was vital.

In the context of the penal system, this is difficult. Muslims are overrepresented in British prisons compared with the population at large, which a government report found “could chime with the radicalisers’ message of the victimisation of Muslims.” Following the July 7, 2005 bombings in London, the scope of terror offenses was widened to include “glorifying” and advocating terrorism. Those jailed for such offenses—overwhelmingly men—are prime targets for further radicalization in prison, to move them from glorification to action. As well as training prison imams in counter-extremism, the report recommended isolation for the most extreme prisoners.