1979: A threatening revolution
Saudi Arabia, a young country pieced together only in the 1930s, has built its legitimacy on religion. By promoting its stewardship of the holy sites at Mecca and Medina, it could justify its royal family’s grip on power.
Iran’s revolution, in 1979, threatened that legitimacy. Iranians toppled their authoritarian government, installing Islamists who claimed to represent “a revolution for the entire Islamic world,” said Kenneth M. Pollack, a senior fellow at the Brookings Institution.
The revolutionaries encouraged all Muslims, especially Saudis, to overthrow their rulers as well.
But because Iran is mostly Shiite, they “had the greatest influence with, and tended to reach out to, Shia groups,” Dr. Pollack said.
Some Saudi Shiites, who make up about 10 percent of the population, protested in solidarity or even set up offices in Tehran — stoking Saudi fears of internal unrest and separatism.
This was the opening shot in the sectarianization of their rivalry, which would encompass the whole region.
“The Saudis have looked at Iran as a domestic threat from the get-go, from 1979,” Dr. Gause said. Seeing the threat as intolerable, they began looking for a way to strike back.
1980-88: The first proxy war
They found that way the next year, when Saddam Hussein’s Iraq invaded Iran, hoping to seize oil-rich territory.
Saudi Arabia, Dr. Pollack said, “backed the Iraqis to the hilt because they want the Iranian revolution stopped.”
The war, over eight years of trench warfare and chemical weapons attacks, killed perhaps a million people. It set a pattern of Iranian-Saudi struggle through proxies, and of sucking in the United States, whose policy is to maintain access to the vast oil and gas reserves that lie between the rivals.
The conflict’s toll exhausted Iran’s zeal for sowing revolution abroad, but gave it a new mission: to overturn the Saudi-led, American-backed regional order that Tehran saw as an existential threat.
That sense of insecurity would later drive Iran’s meddling abroad, said Marc Lynch, a political scientist at George Washington University, and perhaps its missile and nuclear programs.
1989-2002: Setting up a powder keg
The 1990s provided a pause in the regional rivalry, but also set up the conditions that would allow it to later explode in such force.
Saudi Arabia, wishing to contain Iran’s reach to the region’s minority Shiite populations, sought to harden Sunni-Shiite rifts. Government programs promoted “anti-Shia incitement in schools, Islamic universities, and the media,” Toby Matthiesen, an Oxford University scholar, wrote in a brief for the Carnegie Endowment.
These policies, Dr. Matthiesen warned, cultivated sectarian fears and sometimes violence that would later feed into the ideology of the Islamic State.
In 1990, Iraq invaded Kuwait, a Saudi ally. The United States, after expelling the Iraqis, established military bases in the region to defend its allies from Iraq. This further tilted the regional power balance against Iran, which saw the American forces as a threat.
Iraq’s humiliating defeat also spurred many of its citizens to rise up, particularly in poorer communities that happened to be Shiite Arab.
In response, Dr. Gause said, “Saddam’s regime became explicitly sectarian,” widening Sunni-Shiite divides to deter future uprisings. That allowed Iran, still worried about Iraq, to cultivate allies among Iraq’s increasingly disenfranchised Shiites, including militias that had risen up.
Though it was not obvious at the time, Iraq had become a powder keg, one that would ignite when its government was toppled a decade later.
2003-04: The Iraqi vacuum opens
The 2003 American-led invasion, by toppling an Iraqi government that had been hostile to both Saudi Arabia and Iran, upended the region’s power balance.
Iran, convinced that the United States and Saudi Arabia would install a pliant Iraqi government — and remembering the horrors they had inflicted on Iran in the 1980s — raced to fill the postwar vacuum. Its leverage with Shiite groups, which are Iraq’s largest demographic group, allowed it to influence Baghdad politics.
Iran also wielded Shiite militias to control Iraqi streets and undermine the American-led occupation. But sectarian violence took on its own inevitable momentum, hastening the country’s slide into civil war.
Saudi Arabia sought to match Iran’s reach but, after years of oppressing its own Shiite population, struggled to make inroads with those in Iraq.
“The problem for the Saudis is that their natural allies in Iraq,” Dr. Gause said, referring to Sunni groups that were increasingly turning to jihadism, “wanted to kill them.”
This was the first sign that Saudi Arabia’s strategy for containing Iran, by fostering sectarianism and aligning itself with the region’s Sunni majority, had backfired. As Sunni governments collapsed and Sunni militias turned to jihadism, Riyadh would be left with few reliable proxies.
As their competition in Iraq heated up, Saudi Arabia and Iran sought to counterbalance each other through another weak state: Lebanon.
2005-10: A new kind of proxy war
Lebanon provided the perfect opening: a frail democracy recovering from civil war, with parties and lingering militias primarily organized by religion.
Iran and Saudi Arabia exploited those dynamics, waging a new kind of proxy struggle “not on conventional military battlefields,” Dr. Gause said, but “within the domestic politics of weakened institutional structures.”
Iran, for instance, supported Hezbollah, the Shiite militia and political movement, which it had earlier cultivated to use against Israel. Riyadh, in turn, funneled money to political allies such as the Sunni prime minister, Rafik Hariri.
By competing along Lebanon’s religious lines, they helped drive the Lebanese government’s frequent breakdowns, as parties relied on foreign backers who wanted to oppose one another more than build a functioning state.
With Iran promoting Hezbollah as the nation’s defender and Saudi Arabia backing the Lebanese military, neither had a full mandate, and Lebanon struggled to maintain order.
As the foreign powers escalated their antagonism, Lebanon’s dysfunction spiraled into violence. In 2005, after Mr. Hariri called for the withdrawal of Iranian-backed Syrian troops, he was assassinated. (Hezbollah has long been suspected.)
Another political crisis, in 2008, culminated with Hezbollah overpowering Sunni militias to seize much of Beirut. Saudi Arabia requested United States air cover, according to a WikiLeaks cable, for a Pan-Arab force to retake the city. Though the intervention never materialized, the episode was a dress rehearsal for the turmoil that would soon come to the wider region.
2011-14: The implosion
When the Arab Spring toppled governments across the Middle East, many of them Saudi allies, Riyadh feared that Iran would again fill the vacuums. So it rushed to close them, at times with force. It promised billions in aid to Jordan, Yemen, Egypt and others, often urging those governments to crack down.
After pro-democracy protesters rose up in Bahrain, a Saudi ally whose Sunni king rules over a majority Shiite population, Saudi Arabia sent 1,200 troops.
In Egypt, Saudi Arabia tacitly supported a 2013 military takeover, seeing the military as a more reliable ally than the elected Islamist government it replaced. As Libya fell into civil war, it backed a hard-line general who was driving to consolidate control.
Though Iran has little influence in either country, Saudi Arabia’s fear of losing ground to Iran made it fight harder to retain influence wherever it could, analysts believe.
Syria, an Iranian ally, reversed the usual dynamic. Saudi Arabia and other oil-rich Sunni states steered money and arms to rebels, including Sunni Islamists. Iran intervened in turn, sending officers and later Hezbollah to fight on behalf of Syria’s government, whose leaders mostly follow a sect of Shiism.
Their interventions, civil war scholars say, helped lock Syria in the ever-worsening stalemate that has killed over 400,000.
2015-16: ‘What is wrong with you people?’
The United States has struggled to restore the region’s balance.
President Obama has urged Iran and Saudi Arabia “to find an effective way to share the neighborhood and institute some sort of cold peace,” he told The Atlantic.
But Dr. Lynch called this plan for “a self-regulating equilibrium” between the Mideast powers “far-fetched.”
The nuclear agreement with Iran, instead of calming Saudi nerves, hit on fears that “the United States wants to abandon them in order to ally with Iran,” Dr. Lynch said, calling the belief “crazy” but widespread.
Mr. Pollack said he often heard Sunni Arab leaders express this as a metaphor.
“They would say, ‘What is wrong with you people? You have this good, loving, loyal wife in us, and this crazy mistress in Iran. You don’t understand how bad she is for you, and yet you endlessly run off to her the moment that she winks at you,’” he recounted.
The White House looked for other ways to reassure Saudi leaders, facilitating arms sales and overlooking Saudi actions in Egypt and Bahrain.
Then came Yemen. A rebel group with loose ties to Iran ousted the Saudi-backed president, deepening Riyadh’s fears. Saudi Arabia launched a bombing campaign that inflicted horror on civilians but accomplished little else.
The assault receives heavy American support, though the United States has few interests in Yemen other than counterterrorism and sometimes criticizes the campaign. In exchange, Riyadh acquiesced to the Iran deal and began to follow Washington’s lead on Syria. But the underlying proxy war remained.
A future of ‘failed and failing’ states
Asked when the Iran-Saudi struggle might cool, Mr. Pollack said he doubted that it would: “Where we’re headed with the Middle East is the current trend extrapolated, with more failed and failing governments.”
In Yemen, this is already “reorganizing Yemeni society along sectarian lines and rearranging people’s relationships to one another on a non-nationalist basis,” Farea al-Muslimi, an analyst, wrote in a Carnegie Endowment paper, which cited similar trends across the region.
Continued crises will risk sucking in the United States again, Mr. Lynch said, adding that no American president was likely to persuade Saudi Arabia or Iran to stay out of regional conflicts that it saw as potentially existential threats.
President-elect Donald J. Trump will enter office having echoed Saudi Arabia’s view of the region.
Iran “took over Iraq,” he said at a rally in January. “They’re going to have Yemen. They’re going to have Syria. They’re going to have everything.”
Mentioning both the president-elect and Hillary Clinton, Dr. Gause said he doubted that any administration could reset the Middle East’s power struggles.
“I do not think that the fundamental problem of the region,” he said, “is something that either Mr. Trump or Mrs. Clinton could do that much about.”