Jeddah, Saudi Arabia, is today an unremarkable Middle Eastern port city, with unremarkable problems. The largest safety concern is traffic; Saudi men tend to drive recklessly down the wide streets. But Jeddah’s problems have not always been so quotidian. Until recently, the city was an epicenter of the jihadist violence that racked Saudi Arabia for much of the past decade. Terrorists connected to al-Qaeda started attacking foreigners in the kingdom in 1995, but by 2003, the attacks had become more indiscriminate, sometimes targeting the Al Saud regime directly, and often killing Saudis. In Jeddah, militants battled police in the streets, bombed two banks, stormed the United States consulate, and shot Westerners in broad daylight. During 2003 and 2004 throughout Saudi Arabia, 22 terrorist attacks killed 90 civilians and wounded many more.

Yet today, this insurgency has virtually disappeared. The kingdom saw no comparable attacks in 2005 and only one in 2006, a failed car-bomb attempt. The only other attack since 2004 occurred this February, when four Frenchmen were killed while touring outside Medina. It is not known yet whether those killings were connected to al-Qaeda.

Why the change? Revulsion against the killing of civilians, especially Muslims and children, is part of the answer: As the attacks multiplied, popular support for al-Qaeda plummeted, and Saudi citizens became more cooperative in rooting out militants. But the Saudi government deserves a large share of the credit; it took full advantage of that shift in sentiment— and even reinforced it—with an innovative counter­terror strategy.

During the peak of the insurgency, the Saudi authorities mixed an aggressive crackdown—involving numerous raids—with an offer, in 2004, of amnesty to members of al-Qaeda who would turn themselves in and renounce the group. The government presented the amnesty as a way for apostates to “return to God,” and one of its leading public proponents was Safar al-Hawali, a prominent Wahhabist cleric. The raids cleared the streets of hundreds of al-Qaeda members and active sympathizers, including several leaders. About 60 more jihadists, including two on the kingdom’s most-wanted list, took the amnesty.

What’s most interesting is what the Saudi government did with many of its new prisoners. It put them through an intensive religious, psychological, and familial counseling regimen, known as the “advisory committee” program, aimed at rehabilitating them. The experience of one prisoner (according to an English-speaking relative) demonstrates the process.

In 2004, this prisoner (whom I’ll call Ali) was a 22-year-old student in Riyadh. Ali had grown up in the Sahwa (or “Awakening”) movement, a political offshoot of Wahhabism. Like many Saudis, he had encountered al-Qaeda online, through its biweekly Web magazine Sawt Al-Jihad. Ali had become enthralled, seeing for the first time the tenets of Sahwa put into action. He read all of the articles, forwarding them in e-mails and posting them on other sites. In essence, he had become a blogger for al-Qaeda. One afternoon while at his computer, Ali heard police approaching. They had come for him.

When Ali arrived at the Al-Hayir prison just south of Riyadh, he was interrogated, and he confessed his actions. He was then offered the opportunity to renounce the movement and go through the advisory-committee program. This would allow him to return to his family and finish his education; the alternative was an indefinite prison term. Ali told his interrogator he was interested.

Ali was housed with a large group of prisoners; some were fellow al-Qaeda sympathizers he had come to know online. Many of these men had never been officially recruited into al-Qaeda in Saudi Arabia (which carefully vets prospective members for fear of infiltration), and hadn’t attempted any acts of terrorism. The prisoners would meet in groups with respected clerics like Hawali, debating the tenets of al-Qaeda and whether these beliefs were true to Islam. As prisoners brought up rationales for terrorism, the clerics would use Islam to refute them. The group discussions were interspersed with one-on-one meetings with clerics and psychologists. (The latter provide therapy, but are employed primarily to ferret out prisoners who are insincere in their disavowal of al-Qaeda.)

After two months, Ali was allowed to see his family. (For detainees not viewed as threats, family members are encouraged to visit, and they often express disappointment in the prisoner. The role of families in fighting the insurgency is not limited to the reform program; during the initial amnesty period, families of those on Saudi Arabia’s most-wanted list appeared in local media asking their loved ones to surrender.) After two more months of family visits, counseling, and religious discourse, Ali was paroled. (The duration of confinement for prisoners varies.) Weekly visits followed with an officer of the Saudi secret police, who asked where he’d been and whom he’d seen. The secret police monitor the real and the virtual neighborhoods of the kingdom where militant Islamists congregate, and they make use of informers to track the parolees. After several months of parole with a spotless record, Ali “graduated” and was free. Today he has returned to his studies and is trading stocks in his spare time.

If Saudi methods call to mind the deprogramming of brainwashed cult members, that’s no coincidence—Saudi government officials speak of al-Qaeda as a cult, and they believe that deprogramming is exactly what is called for. “Every cult, [as a] first step [to] recruiting someone, cuts him off from his family … and presents itself as an alternative family,” says Prince Turki al-Faisal, a former Saudi intelligence chief who was until recently the Saudi ambassador to the United States. “Second, it cuts him off from his social links, and … finally from his national links.” The Saudi authorities, rather than further isolating their detainees, work to reestablish those links.

Marc Sageman, a former CIA officer and a forensic psychiatrist, did a biographical study of 400 al-Qaeda members. Loneliness, he found, was the emotion that drove most of them toward extremism and terror. Seventy percent joined al-Qaeda while living in another (often Western) country, most of them away from their families. When the young men became homesick, they drifted to a familiar place, the mosque, and then into radical communities within the mosque that offered camaraderie and purpose. (Today, Sageman warns, this same migration can occur almost entirely over the Internet, as it did in the case of Ali.) By reacquainting jihadists with their families and a more peaceable interpretation of their religion, and by challenging their motivations for joining extremist movements, the rehabilitation can overcome the alienation that drives many of them. While these efforts may be lost on the truly hard-core terrorists involved in the leadership and operations of al-Qaeda, they’ve proved effective for those who have mostly flirted with the ideology.

Of the 1,500 Saudis who have entered the program since it began in 2004, the Saudi interior ministry claims that some 500 have been rehabilitated and, according to Prince Turki, “brought back from al-Qaeda.” While these graduates are not walking out of prison ready to make peace with Israel, they have renounced terrorism. “The Saudis aren’t countering al-Qaeda with the nice liberal ideas that we would like,” says Gregory Gause, the director of the Middle East–studies program at the University of Vermont and an observer of the kingdom, “but it works.”

Will it continue to work? Will some graduates of the program eventually return to their old ways? These questions cannot be answered with certainty. A less comprehensive attempt to reform militant Islamists in Yemen met with mixed results. For several years, beginning in 2002, the Yemeni judge Hamoud al-Hitar and four other Islamic scholars conducted ideological debates with extremist prisoners, eventually releasing nearly 400 who pledged to cease terrorist activities in Yemen—a promise they all appear to have kept, at least technically. But Hitar has publicly claimed that resistance to occupation in Iraq is legitimate and not synonymous with terrorism; the Iraqi insurgency, he says, was never a subject of his prisoner dialogues. The program came to a halt in late 2005 after several graduates allegedly crossed into Iraq to fight in the insurgency.

The Saudi program would not work at Guantánamo Bay—a place entirely isolated from family and Muslim culture—but it deserves a close look in Europe and Asia, and in other parts of the Middle East. And its apparent success so far holds a larger lesson for the American government: Al-Qaeda is a spiritually vulnerable organization. In the battle for the “hearts and minds” of Muslims, it is no juggernaut. Taking that battle more seriously—if only by minimizing the sorts of inflammatory statements and actions that generate al-Qaeda recruiting posters—might go a long way toward turning al-Qaeda from a global movement back into an isolated, if dangerous, cult.