Except for the machine guns and guard towers, the al-Hair high-security prison looks remarkably like a hotel – especially the conjugal-visit wing.

Beyond a heavy iron gate, its bars painted a cheerful lavender, a red carpet stretches the length of a long hallway, where each of the 38 private cells has a queen-size bed, a fridge, a television and a shower.

Here, just around the corner from the prison ATM, married inmates are allowed to spend three to five private hours with their wives at least once a month, with fresh linens and tea and sweets on the nightstand.

Nearly 1,100 high-security prisoners, all of them jailed on terrorism-related charges, are serving time in this prison a few miles south of Riyadh. Al-Hair is the largest of five high-security Saudi prisons established in the past decade to deal with a growing terrorism threat, first from al-Qaeda and more recently from the Islamic State.

Saudi prisons long have been largely off-limits to journalists and human rights monitors. But officials said Interior Minister Mohammed bin Nayef, the deputy crown prince, has ordered that journalists be allowed to visit, hoping to refute allegations from human rights groups that Saudi Arabia tortures prisoners.

So on a recent Sunday afternoon, Warden Mohammed al-Ahmed led me on a rare visit inside the al-Hair prison.

“We have nothing to hide,” he told me. “Point at any building, point at any cell. You can see anything you want to see.”

For the next six hours, I was able to direct my own tour, and the warden gladly took me wherever I wanted to go. We saw cellblocks, the hospital, solitary-confinement cells, classrooms and recreation areas. He never declared anything off-limits, though I wasn’t allowed to take photos.

We started with tea, in typical Saudi style, and a PowerPoint presentation that detailed the government’s strategy of showering inmates with perks rather than locking them down in harsh, Guantanamo Bay-style conditions.

TAKING CARE OF FAMILIES

The Saudi government essentially puts each inmate’s family on welfare. The government gives them money for food, rent and school fees, and it pays airfare and hotel expenses for families to come visit — even for foreign prisoners whose families live overseas. Escorted by guards, many prisoners (except those convicted of murder) are allowed to attend funerals and weddings of close family members, and they are given as much as $2,600 in cash to present as a wedding gift.

After the presentation, we visited the Family Home, a hotel within the prison that is used to reward prisoners for good behavior. The hotel has 18 large suites, which can sleep as many as nine family members and have lots of fresh flowers, a well-stocked buffet and a playground for children.

Officials said the government spent $35 million last year on those perks.

“Just because someone is a criminal, we do not punish his family, too,” Ahmed said. “Our strategy is to take care of these people to make the community better. This is what Islam tells us to do.”

The majority of the 3,500 inmates in the five high-security prisons have been convicted of terrorism-related offenses, including al-Qaeda attacks inside the Saudi kingdom, that happened before the rise of the Islamic State last year.

Gen. Mansour al-Turki, spokesman for the powerful Ministry of Interior, whose Mabahith secret police run the high-security prisons, said taking care of inmates’ families is part of the Saudi strategy of trying to rehabilitate radicals.

The Saudis have a long-standing program of placing those convicted of terrorism-related offenses in an intensive program of education and religious study designed to try to alter their thinking and behavior.

Inmates in the high-security prisons start with months-long in-depth courses inside the prisons. When they finish their sentence, they are transferred to one of two large rehabilitation centers, in Riyadh and in Jiddah, for further studies.

“If you lose these inmates when they are in prison, they will come out of prison more radical,” Turki said, adding that supporting their families also helps make sure they, too, don’t “fall into the hands of the terrorists.”

Turki said that about 20 percent of those who have gone through the rehabilitation program have returned to terrorism-related activities. Many rights activists think the failure rate is higher than Saudi officials admit.

Critics often assert that Saudi Arabia, or at least many rich Saudis, supports violent Islamist radicals and that the government’s emphasis on rehabilitation reflects a certain sympathy with terrorists.

AVOIDING ‘TERRORIST UNIVERSITIES’

But Saudi officials say that no country, except for Syria and Iraq, is more directly threatened by the Islamic State. They say their approach to convicted terrorists is more pragmatic and effective than simply throwing thousands of them in prison for decades and hoping that their friends and family don’t become radicalized.

“I don’t think we should be reflexively opposed to these programs,” said Bruce Hoffman, director of the Center for Security Studies at Georgetown University. “The hard-core, wild-eyed fanatics we are never going to rehabilitate, but a solution that says they are all the same and we should lock them away forever isn’t effective, either.”

Hoffman said a 20 percent recidivism rate is far better than the 70 to 75 percent recidivism rate for violent criminals in the United States. He said prisons without rehabilitation programs can become “terrorist universities” that turn minor offenders into hardened militants. He also said that inmates who are coaxed away from radical thinking can also provide valuable intelligence about terrorist groups.

“Programs like this can be enormously effective,” he said.

To be absolutely clear, Saudi Arabia has a poor human rights record, and the fact that no prisoners were tortured in front of me is not proof that it doesn’t happen.

According to the U.S. State Department and human rights groups, the Saudis practice arbitrary detention, and torture allegations are rampant. Saudi Arabia executed 79 people by beheading in 2013, and its extreme interpretation of sharia law still calls for medieval punishments, including amputations and the stoning of adulterers.

Most recently, Saudi courts sentenced Raif Badawi, a blogger who questioned the dominant role of the Saudi religious establishment in daily life, to 10 years in prison and 1,000 public lashes, a punishment condemned as barbaric by rights groups.

Human Rights Watch and others also have alleged that the Saudi government has used its tough anti-terrorism laws to lock up hundreds of people virtually indefinitely, often for simply criticizing the government, and has convicted others in secret and unfair trials.

They also have condemned Saudi prisons for being overcrowded and often dangerous places, but those allegations usually concern the prison system for those convicted of crimes not related to terrorism. The Saudi government operates about 20 regional prisons, roughly the equivalent of a U.S. state prison, and about 90 local lockups, similar to U.S. city or town jails. Those facilities house about 50,000 prisoners, nearly half of them foreigners.

Rights groups have cited reports of violence among prisoners and cases of guards subjecting prisoners to strobe lights, loud music, cold temperatures and long periods of solitary confinement.

Turki denied those allegations. He said that more than 11,500 people have done time in the five high-security prisons since 2003 and that about 8,000 of them have been released.

“Do you hear them going out in public and saying, ‘I was tortured’?” he said. “There are thousands and thousands of them. If we were torturing people, they would say so.”

As the tour continued, Ahmed, the warden, drove me through a vast open yard to the main prison building, where we passed through huge metal doors, metal detectors and a couple of sets of iron gates.

“What would you like to see?” he asked.

I picked a hallway at random, and he ordered the guards to open the gate. The hallway was at least 50 yards long, with paintings of desert scenes hanging on the walls between cell doors.

Halfway down, I chose a random cell and asked to interview the prisoners inside. Six surprised-looking young men, all in their early to mid-20s, wearing long, prison-issued gray robes, greeted me.

The cell, identical to several I saw later, was a large cube about 20 feet by 20 feet, with 20-foot-high ceilings. High on one wall were four windows that filled the cell with natural light.

The six men slept on single mattresses on the carpeted floor and watched a TV mounted high on one wall. The room was spartan but clean, with a large bathroom and shower area. Plastic bags filled with cookies, candy bars, apples and bananas hung on pegs on the wall.

ONE PRISONER’S STORY

One young inmate, Fahad, told me that he was awaiting trial on terrorism charges. He said he traveled to Syria last year to join the Islamic State because he wanted to fight against Syrian President Bashar al-Assad.

“But when I got there, it was not like they told us,” he said.

Fahad, 25, said the Islamic State was fighting not against Assad but against other rebel groups. He said Islamic State militants took his passport, but after two months, he escaped and found his way to the Saudi Embassy in Ankara, Turkey, where he turned himself in. He was returned to Riyadh and sent to al-Hair.

“We’re not happy to be in prison,” Fahad said. “But we have good conditions here.”

With the warden sitting right there, what else could he say? I was still skeptical.

I called Sevag Kechichian, an Amnesty International researcher, who said allegations of mistreatment and torture of prisoners in Saudi prisons are widespread. He said the poor treatment probably happens more frequently in overcrowded local jails, but he said that torture can still happen even in nice-looking prisons — when no one is looking.

I also called Gary Hill, whose work for the International Corrections and Prisons Association, a nonprofit affiliated with the United Nations, has taken him to prisons in 80 countries.

Hill, a Nebraskan, has been going to Saudi Arabia for 20 years to help Saudi officials design training programs for prison staff. He said that what I found in al-Hair “doesn’t surprise me at all.”

“Prisoners there are to be treated nicely — that’s their religion,” Hill said. “From all the interactions I’ve had over many years, they believe that, and they do it.”

Kechichian and Hill have never been inside a Saudi prison. So I also arranged a telephone call with Mohammed al-Qahtani, a Saudi economist who was sentenced to 10 years in prison in 2013 for criticizing the government. He is serving his sentence in a general prison close to al-Hair.

Qahtani said that many prisoners’ families receive money from the prison, though his family, now living in the United States, has turned it down on principle.

Qahtani said he has access to newspapers, books, television — and daily phone calls with his family. He said that many of his fellow inmates have been convicted of violent crimes or drug trafficking and that there is regular violence among prisoners. He said that one inmate committed suicide after being left in solitary confinement for more than a month.

Qahtani is angry about being imprisoned for simply speaking his mind, but he said he had no serious complaints about his living conditions.

“It’s not bad,” he said.