There is something familiar about the Islamic State’s (also known as ISIS) current terrorist campaign in Saudi Arabia. Indeed, it looks an awful lot like al Qaeda’s 12 years ago. Back then, the House of Saud successfully held off its jihadist foe. This time around, however, the enemy is more resilient and resourceful, and regional cards seem to be stacked against the Kingdom. Riyadh will need foresight, statecraft, and above all, introspection to repeat its previous success.

Although the late al Qaeda leader Osama bin Laden focused primarily on targeting the United States, Saudi Arabia also preoccupied his mind. The Saudis must be overthrown, he kept saying, because they opened the door to “Crusader and Zionist” domination of the Muslim world and betrayed the Palestinian cause to “Jews and Americans.” But beyond the perceived transgressions, bin Laden understood that, ultimately, he would need to wage war with Saudi Arabia over the biggest stakes of all: control over Islam’s holy cities and enormous oil wealth.

Given U.S. support for the Saudis, bin Laden was aware of the difficulty of this mission. Yet he was determined to see it through. When Kandahar fell in 2002 following the U.S. invasion of Afghanistan, hundreds of Saudi members of al Qaeda returned to the Kingdom and joined sleeper cells that had been covertly operating there at bin Laden’s direction. By early 2003, those cells had turned into an extensive terrorist infrastructure mostly made up of Saudis, prompting bin Laden to order an insurrection on February 13, 2003, which coincided with the eve of the U.S. invasion of Iraq. (In fact, the invasion offered al Qaeda a unique opportunity to go after the Saudi monarchy by appealing to the intense anti-American reaction the invasion had provoked among the Saudi population.)

Islamic State claimed responsibility for this car bomb explosion near the Shia al-Anoud mosque in Saudi Arabia's Dammam, May 29, 2015. Faisal Al Nasser / Reuters The war’s first terrorist act in the Kingdom came less than three months later on May 12, when multiple suicide bombers detonated car bombs in several housing compounds in Riyadh used by American and other Western contractors working in the city. Seven Americans were among the 34 killed, and another 200 people were wounded. What followed would be the longest and most violent internal struggle within Saudi Arabia in its modern history. Not even the 1979 uprising in the Grand Mosque in Mecca was as serious of a threat to the House of Saud as al Qaeda’s onslaught.

The insurgency was well organized, lethal, and widespread. Gun battles between Saudi security forces and bands of al Qaeda operatives turned into almost daily incidents in urban areas. Clashes occurred in Jeddah, Khobar, Mecca, Riyadh, Taif, Yanbu, and other cities and towns across the country. Al Qaeda used car bombs to target Western facilities and also kidnapped and murdered Western citizens. There were occasional episodes of relative calm, during which it appeared the security forces had degraded al Qaeda, but they were followed by new eruptions of violence. Terrorists assassinated senior officers of the Saudi Ministry of Interior (MOI), and even the MOI’s evocative headquarters in Riyadh, which was built to resemble an inverted pyramid, was targeted for attack. One of the most violent assaults was on the U.S. consulate in Jeddah on December 6, 2004. Nine people were killed when an al Qaeda cell penetrated the consulate grounds and almost succeeded in capturing a young woman who was a U.S. diplomat.

But Riyadh ultimately prevailed in its counterterrorism efforts, and had effectively crushed al Qaeda’s insurgency by 2006. (Even though the terrorists continued to plot spectacular attacks for another year, their attempts were foiled by the security services.) Supported by a religious establishment that painted al Qaeda’s ideology as a perversion of Islam, the MOI and other Saudi government agencies used highly effective counterterrorism measures, including the publication of captured or killed terrorists’ names, cell penetration, cyber warfare, and denial or disruption of terrorist funding. The Saudi authorities also set up a reeducation and rehabilitation program in order to turn captured terrorists into peaceful citizens. The results were excellent—less than 10 percent returned to jihad, according to Said Al Bishi, director of the rehabilitation centers—encouraging governments in the region battling terrorism to adopt and customize parts of the program.

DIVIDE AND CONQUER

Regardless of the nature of ISIS’ presence in the Kingdom, the number of alleged ISIS members who have been arrested there—more than 400 thus far—is worrisome.

ISIS leader Abu Bakr al-Baghdadi has neither the charisma nor the sophisticated and integrated network bin Laden had in the Kingdom in 2002–06. But his message for Saudi Arabia, “the head of the snake and stronghold of disease” as he described it, is the same as bin Laden’s. Baghdadi’s plan, however, which he borrowed from the late chief of al Qaeda in Iraq, Abu Musab al-Zarqawi, is more clever, devilish, and dangerous: His goal is to ignite a sectarian civil war in Saudi Arabia by targeting the Shia community and provoking them to unleash their anger against the Saudi government. (Dozens of Saudi Shia have already started forming civil defense groups to better protect themselves against ISIS and other threats, an outcome that has made the Saudi authorities uneasy). Baghdadi’s group has struck the Shia community three times since November 2014, but his most successful attacks came during Friday prayers last month in Shia mosques in Dammam and near Qatif in the eastern province (which holds a large concentration of Shia), killing a total of 25 people and injuring at least another 120.

Only the MOI knows whether ISIS’s strategy is being carried out by lone-wolf individuals or a set of coordinated cells. Yet regardless of the nature of ISIS’ presence in the Kingdom (Baghdadi has already labeled it as the Nejd Province, the desert heartland of Saudi Arabia that was first created in the eighteenth century), the number of alleged ISIS members who have been arrested—more than 400 thus far—is worrisome. What’s more concerning, not just for Saudi Arabia but also for U.S. officials, is that the vast majority of those captured are Saudi nationals with a bold list of Saudi and U.S. targets. When the Saudi security services arrested 93 of them in April, they learned that they were planning to attack the U.S. embassy in Riyadh.

Thwarting Baghdadi will not be easy, but it is certainly doable. Several factors are working in Riyadh’s favor, but a few are not. Since bin Laden’s insurgency, the Kingdom has gained a tremendous amount of experience in counterterrorism that is proving very useful in the current fight against ISIS. The rehabilitation program, for example, has been running for more than a decade.

ISIS also does not have the benefit of strategic surprise that al Qaeda did. One of the reasons why al Qaeda was so effective in the first couple of years of the insurgency is that the Saudi authorities, along with the U.S. intelligence services, were unaware of the extent of the terrorist organization’s underground infrastructure. Other circumstances that favor the Kingdom in its fight against ISIS include the rise of Saudi nationalism in recent months, especially after the empowerment of a new and younger leadership, and Riyadh’s military campaign against the Houthi rebels in Yemen. Finally, the fact that Baghdadi is Iraqi, and not Saudi like bin Laden, matters. Although ISIS has followers from various nationalities and backgrounds, the bulk of its leadership is Iraqi, which may be a harder sell for future Saudi recruits.

To make sure ISIS does not firmly set up shop in the Kingdom, Saudi Arabia should think hard about complementing its counterterrorism campaign with some necessary and long overdue conciliatory measures toward the Kingdom’s Shia population.

But Saudi Arabia’s war in Yemen, its regional struggle with Iran, and ISIS’ expansion and staying power are important challenges that will complicate Riyadh’s efforts to stop Baghdadi. Although the Kingdom is not currently militarily overstretched, it could soon be fighting a multi-front war if Iran steps up its involvement in Yemen and Syria, as well as tries to foment instability again in Bahrain. The more attention and resources Riyadh devotes to external dangers, the less prepared it will be on the domestic counterterrorism front against ISIS. Last but not least, as clichéd as it sounds, ISIS is not al Qaeda. The former is on the rise and is in control of vast lands and large amounts of material and human resources in the region that the latter could only have dreamed of. Worse still, despite a U.S.-led coalition against it, ISIS faces little effective resistance.

SHUTTING DOWN SHOP

To make sure ISIS does not firmly set up shop in the Kingdom, Saudi Arabia should think hard about complementing its counterterrorism campaign with some necessary and long overdue conciliatory measures toward the Kingdom’s Shia population. Indeed, Riyadh’s counterterrorism efforts in its eastern province will never amount to much if the Shia community continues to be treated so poorly by its own government.

Following May’s suicide bombing in Qatif, King Salman dispatched Crown Prince Mohamed bin Nayef to the area to offer condolences to the victims and their families. He also allowed Saudi television to broadcast the Shia funerals in full. On June 3, he referred to Shia volunteers, who had died preventing the second bomber from entering the mosque in Dammam, as “martyrs” and “heroes.” Grand Mufti Abdul Aziz ibn Abdullah al-Sheikh and other Saudi clerics also condemned the attack. But all of this remains symbolic. Saudi newspapers and Twitter accounts remain filled with anti-Shia vitriol, with many Saudi commentators even blaming Iran for the attacks.

Shia Muslims carry the coffin of a Saudi man killed in a blast at a packed Shia mosque, May 25, 2015. A suicide bomber killed 21 worshippers, the first attack in the Kingdom to be claimed by Islamic State militants. Reuters

But placating the Shia populace involves much more than an attempt, however honest, at providing the Shia basic rights. It is essentially about limiting the influence of radical Saudi clerics who are spewing hatred against the Shia in the Kingdom and across the Middle East, in the name of fighting Iran. King Abdullah bin Abdulaziz Al Saud’s dying wish was for the Saudi Ulama (or religious authorities) to adopt less rigid dogma and be more receptive to change. But he is gone.

Although it is true that the Saudi king cannot rule effectively without the clerics, he does hold absolute power, as the country’s 1992 Basic Law of Government clearly stipulates. He also controls the country’s wealth and the armed forces and selects the leader of the country’s highest religious office—the grand mufti. With the political shake-up he recently orchestrated, there is no question that King Salman is the man in charge.

So far, Salman has made some bold decisions that have surprised many, such as centralizing power in the hands of his 29 year-old son, Prince Muhammad, who currently oversees economic and defense policy. But the boldest and most important decision Salman has yet to make is leading a national campaign that seeks to eradicate anti-Shiism in the Kingdom. This can only be achieved by further limiting the influence of uncompromising Wahhabi sheikhs, which the late king had tried to do. More broadly, it involves reviewing the media’s and the clerics’ activities and hold on the educational system. Saudi Arabia’s very survival depends on it. Absent such an effort, the Kingdom’s war with terrorism will be a long one.