The sudden and unexpected success of ISIL (al Qaeda in Iraq and the Levant) in early 2014, especially the capture of eastern Syria and the Iraqi city of Mosul, had serious repercussions in Saudi Arabia where it captured the imagination of young men raised in a climate of strict adherence of Islamic law and years of state funded religious education. The last time this happened was in 2003 when the U.S. and Britain invaded Iraq and many conservative Islamic clergy declared this sacrilege (non-Moslem soldiers in Arabia) and thousands rushed off to join Islamic terror groups in Iraq while a smaller number stayed home and tried to get a terror campaign going. Both groups failed, because of the American tactics and tech in Iraq and because of Saudi police efforts and popular opposition to Islamic terrorism this close to home. While nearly half of the Saudis who went to Iraq died there, many of those who returned were arrested for trying to stir up trouble at home. The Saudis who went to war at home were largely wiped out and ended up dead, in prison or in exile. By 2010 Saudi high-security prisons had over 5,500 Saudi inmates. But the Saudis also had a rehab program that succeeded with over 80 percent of Islamic radicals put through these programs, even though most subjects had no choice in the matter. After 2010 the prisons began to empty out as sentences were served, rehab programs completed and things settled down. By 2013 there were only 2013 prisoners in the high-security lockups. Then ISIL happened and now there are nearly 5,000 prisoners.
Learning from past experience the Saudis are quicker to jail (and try to rehab) all those who show any indications of going radical. This includes those who return from fighting for any Islamic radical group in Iraq, Syria, Yemen or anywhere else. The government has installed the best Internet surveillance systems money can buy and that catches a surprising number of radicalized young Saudis who ignore warnings to be careful what they say on the Internet or their cell phones. While many young Saudis are going off to Syria and Iraq to become Holy Warriors, there are far fewer Islamic terror attacks at home than there were in 2003-6.
The Saudi counter-terrorism methods have been copied by many of their oil-rich Arab neighbors. An exception is Iraq, where sectarian battles between the Shia majority and the Kurdish and Sunni minorities has become a lot more than the government can handle.