ROUMIEH, Lebanon (AP) — For years, Islamist prisoners of a Lebanese jail connected with fellow militants on the outside through smartphones and computers purchased from guards, operating freely in door-less cells of a notorious jail overlooking the seaside capital of Beirut as the country was struck by deadly bombings.
The relationship between some prisoners in Block B of Roumieh prison and militant groups outside was hardly a secret. The overcrowded, sprawling complex east of Beirut was long denounced by officials as a breeding ground for extremists — lawless within, but trapping hundreds of detainees who languished for years without trial, breeding resentments that likely boosted militant recruitment.
Nothing was done as Lebanon's famously fractious politicians disagreed on how to act regarding the prison. They permitted a situation to emerge in which guards and the wider system colluded to allow inmates to enjoy widespread perks and a freedom that security officials believe allowed them to organize attacks on the outside.
The problem festered until Jan. 12, when commandos used tear gas to clear 900 prisoners out of Block B, following a double suicide bombing in the country's north that killed 9 people — an attack directly organized from the facility, Lebanon's interior minister said.
The prison is a dramatic example of what has become a broader problem around the world, from Paris to Baghdad -- how to incarcerate militants without creating spaces for them to flourish. That challenge takes on greater urgency as the Islamic State group and al-Qaida vie to conduct ever-deadlier attacks, and Western countries struggle to deal with returning citizens who fought alongside militants in Syria, Iraq and Yemen.
In France, one of the brothers who killed 12 people at the office of the satirical Charlie Hebdo magazine met Amedy Coulibaly — who launched his own parallel attack on a kosher grocery — when they were serving time in a French prison.
In Iraq, much of the Islamic State group's current leadership, including self-declared caliph Abu Bakr al-Baghdadi, spent time in Camp Bucca, a U.S. military jail that closed in 2009.
"Prisons are often very important to extremist movements," said Peter Neumann, director of the International Centre for the Study of Radicalization at King's College London. "Prison is the place where it comes together."
Block B acquired a notorious reputation after security officials began dumping Sunni radicals there following an uprising in 2007 against soldiers in northern Lebanon. The number of prisoners swelled further as Sunni hardliners began lashing out against Shiites and soldiers in attacks that intensified two years ago, inflamed by sectarian tensions over the war in neighboring Syria.
Hardened jihadis accused of masterminding multiple suicide car bombings mixed with newly-converted ideologues and innocents swept up in haphazard raids.
Prisoners of Block B were involved in the Jan. 10 suicide bombings that killed nine people in a coffee shop in the northern Lebanese city of Tripoli. An investigation showed phone calls made from the prison to the bombers in the days leading up to the attacks, said Interior Minister Nohad Machnouk.
The minister suggested attacks had been coordinated from Block B for years, going so far as to describe a functioning terrorist "operations room" inside the prison.
"All the stories you have heard through the years, from 2009, 2010, until today, of the operations room in Roumieh prison that undertook many terrorist operations in Lebanon... has ended today," he said after the prisoners were transferred.
Two security officials said that information gleaned from documents obtained from Block B has already led to the arrest of three men suspected of plotting a series of suicide attacks. The officials spoke on condition of anonymity because they weren't allowed to speak to reporters.
Details that emerged after Block B was cleared suggest how wild it had become.
Prisoners purchased communications equipment from corrupt guards, removed the doors from their cells and refused to attend roll call, the security officials said. By the time Block B was raided, commandos found a room stacked with Wi-Fi routers, as well as computers and mobile phones, according to security officials, photos and leaked videos.
But while certain powerful inmates enjoyed privileges, others languished in squalor due to failures in Lebanon's justice system — a combination that made Roumieh particularly toxic, said Raphael Lefevre of the Carnegie Middle East Center in Beirut.
Of the 900 prisoners there, some are still awaiting trial for crimes they are accused of committing in 2007. Others were ordered released years ago, but remain incarcerated, he said.
Omar Saif, an activist campaigning for prisoners' rights, described it as "Lebanon's Guantanamo."
Saif said his father was detained in 2009, but only charged in 2012. Most prisoners, like his father, were charged with relatively minor crimes like transporting and harboring militants.
"This is oppression," Saif said.
Conditions in Block B for the ordinary prisoners were poor: crammed dank cells, leaking water, no ventilation, poor food and little heating, according to prisoners' families and rights groups.
It was those conditions that initially prompted families to bring in food, televisions, telephones, blankets, fridges and even paint to make the cells habitable, said relatives waiting to visit on a recent day.
"We did everything for the prison. If we didn't bring our sons food, they would have starved," one woman shouted.
Block B festered in part because it became a sectarian issue in a country paralyzed by a political system that demands consensus among groups with wildly different interests.
Lebanon's Sunni leadership saw the accused militants of Block B as a bulwark against the overwhelming might of the rival Shiite militia Hezbollah. It appears they turned a blind eye to the abuses within and ensured that there could be no political consensus on addressing the problem.
But after politicians formed a new government in February, they appointed the bare-knuckled Machnouk as interior minister. Machnouk felt compelled to act after it became increasingly clear there was a direct link between Islamic militants on the outside and certain Roumieh inmates. Militants launched a cross-border raid from Syria in August, capturing around 20 soldiers and policemen; they demanded the release of Roumieh prisoners in exchange.
Weeks before that raid, Islamic State fighters uploaded a song to YouTube dedicated to the prisoners, mournfully singing "the conditions of the prisoners in Roumieh make me sad, brothers."