By Frank Gardner
Saudi Arabia believes it is achieving a major success in reforming and re-educating Islamist militants and preventing them from going to Iraq to wage violent jihad.
Saudi authorities are attempting to re-educate those bent on jihad
Using a series of new, specially-built prisons, the Saudi authorities are currently re-educating several thousand young men who would otherwise be tempted to attack Western and other targets around the region.
Building a whole network of new prisons is rarely a sign of a happy society. But in Saudi Arabia the authorities believe they are achieving a success rate of more than 70% in turning potential al-Qaeda militants away from violent jihad.
Across the country they have been constructing new, purpose-built prison wings to house thousands of mostly young Saudi men and steer them away from their radical beliefs.
The programme, which was conceived in the aftermath of a wave of al-Qaeda attacks in Saudi Arabia, has global implications.
Most of the 9/11 hijackers were originally Saudi nationals and US commanders in Iraq believe that Saudi jihadists make up the largest contingent of foreign fighters there.
Unlike in Yemen, which has a similar but far less successful programme, the Saudi jihadist rehabilitation programme is run by the country's powerful ministry of interior, under the direction of Prince Mohammed Bin Nayef, a son of the interior minister.
Its officials have the power to send the most fanatical criminals to a high-security jail, or to offer others a second chance of a new life in mainstream Saudi society.
Once they have completed their deradicalisation programme in one of the new jails, former jihadists can be offered government help in starting a business, securing a job, a car, or even a wife.
According to Dr Mustafa Alani, director of security at the Gulf Research Centre, "around 3,000 jihadists are being targeted under the scheme".
"They are not the real hardliners but they are still members of al-Qaeda-inspired cells who could otherwise become fighters."
Dr Alani says that a similar scheme in Yemen has largely failed, with 70% of supposedly reformed jihadists who were released getting re-arrested for terrorist offences. In Saudi Arabia, he says, the re-arrest figure is just 5-7%.
At its core, the programme aims to convince jihadists that theirs is what the Saudi authorities call a "deviant" form of Islam.
The scheme has also attracted critics, worried about re-offenders
To this end, inmates must sit through a series of religious and theological lectures conducted by scholars, clerics and psychologists.
The message they are given is that violent jihad is only permissible in Islam if it has the approval of the state and the authority of the jihadist's parents. Going off to fight the Soviets in Afghanistan in the 1980s, they are told, was permissible but going to fight in Iraq today is not.
Not everyone approves of the scheme. US counter-terrorism officials worry that those released - including former inmates of Guantanamo Bay - will simply go on to plan new attacks.
An earlier jihadist leader, Abdulaziz al-Muqrin, was released prematurely from a Saudi prison and went on to become al-Qaeda's new leader in the country, conducting a violent campaign before he was killed in a shootout with police in 2004.
Conversely, some Saudis resent what they see as a favoured status afforded to those who were on the cusp of becoming violent criminals.
And Dr Saad al-Faqih from the London-based Saudi opposition group Movement for Islamic Reform in Arabia argues that the programme forces a government interpretation of Islam onto inmates with no room for debate.
Dr Faqih, who believes that the Saudi government is holding around 12,000 jihadi prisoners, says: "There is no way you can have a scientific study of how successful this programme is."