At times, his sectarian feelings seemed to outshine his unease about the excesses of some of his more extreme comrades. He did not deny that he had often fought alongside members of the Islamic State of Iraq and Syria, or ISIS, the brutal jihadist group affiliated with Al Qaeda.

Abu Khattab also mentioned proudly that he is no stranger to jihad. He fought as a teenager in Afghanistan (“With the government’s permission!”) and, a few years later, in Bosnia. He chose not to fight the Americans in Iraq “because there are too many Shiites there,” he said, with a look of distaste on his face.

Yet this is a man who lectures inmates at the rehabilitation center every week about ethics and war. The center, like many Saudi institutions, has been somewhat embarrassed by the contradictions of Saudi policy with regard to Syria. Although the center incarcerates some men who have been arrested for trying to travel to Syria, last summer the nephew of Abdelrahman al-Hadlaq, its director, was killed while fighting there. His mother posted statements on Twitter saying she was proud of him.

More recently, the center suffered an even more stinging disappointment involving one of its best-known graduates, a reformed jihadist named Ahmed al-Shayea. He became famous in Saudi Arabia after surviving his own suicide bombing in Iraq in 2004, a bombing arranged by militants with Al Qaeda’s Iraqi branch.

Mr. Shayea was burned and disfigured, but after months in a hospital he emerged and proclaimed himself cured of the jihadist mind-set. He was known as the “living suicide,” and in 2009 an American author, Ken Ballen, devoted an entire chapter to a glowing portrait of him in his book, “Terrorists in Love.”

In November, Mr. Shayea slipped out of Saudi Arabia to Syria, where he is now fighting with the Islamic State of Iraq and Syria. He proudly trumpets his return to jihad on his Twitter feed, which features a picture of him clutching a rifle with his mangled hands.

The Saudi authorities say they have urged their citizens not to go to Syria, but cannot keep track of every Saudi who wants to go fight there. “We try to prevent it, but there are limits to what we can do,” said Mansour al-Turki, a spokesman for the Saudi Interior Ministry. “You cannot prevent all young men from leaving the kingdom. Many of them travel to London or other places, and only then to Turkey, and Syria.”