"The majority of the individuals being investigated, far from being deradicalized, have not only remained active in jihadi militancy, but have become even more radical during their incarceration." — Spanish Interior Ministry.

"We want to prepare ourselves for the jihad for Allah. I have good news: I have created a new group, we are willing to die for Allah at any moment. We are waiting to be released from prison so that we can begin working. We have men, we have weapons and we have targets. All we need is practice." — Mohamed Achraf, in a letter written from prison to another inmate.

The group — which Spain's Interior Ministry described as a jihadi "Prisons Front" (" frente de cárceles ") — was engaged in recruiting, indoctrinating and radicalizing other inmates, as well as in plotting new jihadi attacks.

Spanish police have dismantled a jihadi network operating inside and across more than a dozen Spanish prisons. The network, allegedly linked to the Islamic State, was established and operated by one of the most implacable jihadis in the Spanish prison system — apparently under the noses of prison authorities.

The network's existence has called into question not only the effectiveness of security procedures in Spanish prisons, but also of Spanish "deradicalization" programs, which are aimed at "rehabilitating" Islamic militants for eventual "reinsertion" into society.

The group's core members included 25 jihadis in 17 different prisons (accounting for more than half of the 30 Spanish prisons equipped to house jihadi convicts), according to the Interior Ministry, which provided details of the counterterrorism operation on October 2.

The group — which the Interior Ministry described as a jihadi "Prisons Front" ("frente de cárceles") — was engaged in recruiting, indoctrinating and radicalizing other inmates, as well as in plotting new jihadi attacks.

The network's members included convicted jihadis as well as common inmates who were radicalized in prison. Among them were several Spanish citizens who are converts to Islam. Some members were nearing the end of their sentences and were waiting to be released from prison.

The group's ringleader, Mohamed Achraf, a 44-year-old Moroccan whose real name is Abderramane Tahiri, was serving a 14-year prison sentence for plotting truck bomb attacks against high-profile targets in Madrid, including the Spanish Supreme Court and the Príncipe Pío railway station.

Achraf was scheduled to be released from prison on October 14, 2018 — almost four years early. He was incarcerated in 2008 and served most of his sentence by being moved from one prison to another, a standard protocol aimed at preventing Islamists from establishing a foothold in any one facility and radicalizing other inmates. In February 2018, Achraf was transferred to the Campos del Río penitentiary in Murcia, where he was held in solitary confinement.

On October 1, counterterrorism police searched Achraf's prison cell and discovered that he was running a "disciplined and organized" network of jihadi inmates dedicated to recruiting and radicalizing other inmates, as well as to plotting attacks against specific targets.

The Interior Ministry said that the network carried out its activities through physical interaction between inmates within the same prisons, as well as through "epistolary relationships" among inmates located in different prisons. The network evaded monitoring mechanisms by carrying out communications through the use of inmates who were not subject to special surveillance.

The Murcia-based newspaper La Verdad, quoting police sources, reported that Achraf will likely be prosecuted for new terrorism offenses and, rather than be released early, will be held in preventive detention.

Achraf has a long history of jihadi militancy in Spain. During an earlier prison sentence, served between 1999 and 2002 at the Topas penitentiary in Salamanca, Achraf organized a similar jihadi network — called "Martyrs for Morocco" — which operated inside and across at least five Spanish prisons. The network consisted of four cells that were, according to prosecutors, "perfectly structured and connected to each other."

After the 2004 Madrid train bombings, in which 193 people were killed and 2,000 others injured, Spanish authorities launched a nationwide crackdown on Islamic fundamentalists. A counterterrorism operation — Operation Nova — resulted in the arrest of 36 jihadis, including several members of Achraf's network. Investigators found correspondence which revealed that Achraf was plotting to bomb the Audiencia Nacional, the upper court in Madrid where judicial authorities were investigating the Madrid train bombings.

Investigators also found correspondence between Achraf and other jihadis, including a letter that stated: "Muslims now have two places to go: jail or jihad." Another letter read:

"We want to prepare ourselves for the jihad for Allah. I have good news: I have created a new group, we are willing to die for Allah at any moment. We are waiting to be released from prison so that we can begin working. We have men, we have weapons and we have targets. All we need is practice."

In April 2005, Achraf was extradited to Spain from Switzerland, where he fled after his release from prison, and where he unsuccessfully sought asylum by claiming to be Palestinian.

In February 2008, Achraf was sentenced to 14 years in prison for "promoting and directing a terrorist group." During his trial, the court learned how Achraf, who referred to himself as "Emir," used a makeshift mosque in a prison gymnasium to "indoctrinate" other inmates in the hardline Salafist-takfiri jihadist ideology promoted by the Islamic State.

Given Achraf's history of Salafi-jihadism, and his previous efforts to proselytize and indoctrinate inmates during his first stint in prison, it remains unclear why Spanish authorities allowed him to establish another, even larger jihadi network during his second time in prison.

The newspaper La Verdad reported that Achraf's network "was very organized... and already had specific targets" and "had threatened certain prison officials, some of higher rank." The group had "its own iconography and slogan" and "was perfectly structured, with precise orders of action in prison courtyards and in methods of training."

Achraf's network may be just the tip of the iceberg. A recent analysis of official prison data by the online publication El Independiente found that more than 150 inmates are currently serving time in 28 different Spanish prisons for jihad-related crimes.

Nearly half (72) of the jihad-related convicts are Moroccans, followed by Spaniards (57). Other inmates are from Algeria, Argentina, Bangladesh, Belgium, Brazil, Bulgaria, Denmark, Egypt, France, Mexico, the Netherlands, Pakistan, Portugal, Saudi Arabia and Turkey.

The most frequent crime among jihad-related convicts is membership in a terrorist group, followed by recruitment, indoctrination and training for terrorism and support for an armed group.

In addition, another 120 inmates serving time for non-jihad-related crimes are being monitored for signs of "Islamist fanaticism," according to the newspaper El País, quoting sources from the Interior Ministry.

Achraf's network has also cast a spotlight on the effectiveness, or lack thereof, of Spanish deradicalization programs for jihadi inmates. According to human rights protections guaranteed by the Spanish Constitution, such programs can only be applied on a voluntary basis.

Of the roughly 270 inmates being monitored for jihadist tendencies, only 20 are participating in deradicalization programs, according to the Spanish news agency EFE. The Interior Ministry admitted:

"The majority of the individuals being investigated, far from being deradicalized, have not only remained active in jihadi militancy, but have become even more radical during their incarceration."

Soeren Kern is a Senior Fellow at the New York-based Gatestone Institute.