Last year, Saudi Arabia’s brash young leader, Crown Prince Mohammed bin Salman, the de facto power behind the throne, was instructing his allies in the Trump administration that Iran “must be hit hard.” Now, however, as tension boils between the United States and Iran, the crown prince, fearing Saudi Arabia could get caught in the crossfire, is urging restraint.

Recent months have already demonstrated how U.S. pressure on Iran can also bite the Saudis. Smarting under severe U.S. economic sanctions since the Trump administration’s 2018 withdrawal from the Iranian nuclear deal, Iran launched a major drone and missile strike on Saudi Arabia’s most critical oil facilities in September.

To help defuse the present crisis, bin Salman would do well to follow an example set by one of his predecessors, Abdullah bin Abdul Aziz. In 1997, when tensions were also mounting between Iran and the United States, Crown Prince Abdullah, despite being hawkish toward Iran, initiated a notable detente, helping to calm the region.

Hostility between Saudi Arabia and Iran dates to the 1979 Iranian Revolution and the Iran-Iraq War of the 1980s. The Saudis accused the revolution’s leader, Ayatollah Ruhollah Khomeini, of seeking to impose hegemony over the region under the guise of his brand of Shiite Islam. Khomeini, meanwhile, reviled the Saudis as an ally not only of Iraq but also the United States — what he dubbed “the Great Satan.” For its part, the United States backed Iraq in its war against Iran, but still didn’t want an Iraqi victory. Henry Kissinger quipped at the time, “It’s a pity both sides can’t lose.”

While Khomeini died in 1989, tension between the two Middle Eastern powers continued into the 1990s. The Saudis interpreted all of Iran’s actions as evidence of its hegemonic desires, while the Iranians opposed Saudi approval of the significant military presence the United States maintained in the region after the Gulf War. Throughout the mid-1990s, the two countries were locked in an all-out media war. Iranian news outlets predicted the collapse of the Saudi monarchy, and the Saudi media denounced the Islamic Republic’s thirst for war.

The situation boiled over with the first Iranian attack on Saudi soil, one that targeted the United States: a massive truck bomb that exploded outside the Khobar Towers housing complex, killing 19 U.S. service members. The FBI later determined that the attack had been carried out by an Iranian proxy group, Hezbollah al-Hejaz, at the direction of Iran’s Revolutionary Guards.

In the wake of the attack, President Bill Clinton came under intense domestic pressure to retaliate against Iran, with Iran publicly threatening to strike the U.S.’s Gulf Arab allies if it was targeted by the United States.

For his part, then-Crown Prince Abdullah was reputed to be one of the most anti-Iranian members of the Saudi royal family. One U.S. diplomat who interacted with him in the early 1990s told me that Abdullah practically “foamed at the mouth” when discussing Iran’s theocracy. He even inquired about the possibility of overthrowing it and installing the Washington-based son of the deposed shah in its place. As it happens, that same son, Reza Pahlavi, is today pushing for regime change in Tehran.

Nevertheless, following the Khobar Towers bombing, Abdullah, staring over the abyss of yet another hot war in the Gulf, and no stranger to conflict after the Iran-Iraq War and the first Gulf War, saw the wisdom in defusing the tensions that escalated wildly.

To do so, he began to personally engage with Iranian leaders. In the mid-1990s, Iran, seeking to break out of the isolation imposed on it by the United States, had repeatedly attempted to improve its relationship with Saudi Arabia but had been rebuffed. Then in early 1997, during a summit of Islamic countries in Islamabad, Abdullah met with Iranian President Ali Akbar Hashemi Rafsanjani, and in a symbolic gesture indicating the Saudis’ desire to establish a better relationship, invited Rafsanjani to attend that year’s Hajj, the annual pilgrimage to the Islamic holy sites in Saudi Arabia. Later that year, Abdullah traveled to Tehran to attend another Islamic summit, becoming the highest-ranking Saudi to visit Iran since its 1979 revolution. During his trip, Abdullah even offered to mediate between Iran and the United States.

In this way, Abdullah, despite his personal animosity toward Iran, pushed for reconciliation, not confrontation.

Abdullah had more in mind than just keeping the peace: There was an ongoing power struggle within the royal family.

In 1995, Abdullah’s half brother, King Fahd, had suffered a debilitating stroke. Although he survived, Fahd never recovered, unleashing an intense power struggle between Abdullah and Fahd’s full-brothers, known as the Sudairis. As recounted to me by a royal family insider, Abdullah saw his 1997 initiative to defuse tensions with Iran as a way to enhance his prestige on the world stage and thus gain leverage over his Sudairi rivals. While the power struggle continued for years thereafter, Abdullah ultimately prevailed, becoming king upon Fahd’s death in 2005.

While beneficial to him politically, Abdullah’s reconciliation initiative complicated the U.S.’s policy to contain Iran. The Saudis also proved unwilling to assist the FBI investigation into the Khobar Towers bombing, undoubtedly wanting to forestall U.S. retaliation against the Iranians. The Clinton administration was incensed at this faithlessness on the part of their Saudi ally. Abdullah did not want to damage relations with the United States, but he did want to avert war.

Abdullah’s 1997 initiative ushered in a six-year period of unprecedented cooperation between Saudi Arabia and Iran, lasting until the 2003 U.S. invasion of Iraq. Their brief detente culminated in the 2001 signing of a Saudi-Iranian security agreement, to the benefit of both countries and the wider region.

This episode in Saudi history should be instructive to bin Salman, the current crown prince.

Since ascending to power, bin Salman has embarked on a number of misadventures as he has sought to roll back Iran’s regional influence and cement his country as the regional power broker. He launched a tragic military intervention in Yemen to counter the Iranian-backed Houthis, leading to what the United Nations has called the world’s worst humanitarian crisis. He initiated an embargo on neighboring Qatar and kidnapped Lebanon’s prime minister, both considered too sympathetic to Iran. Contributing to bin Salman’s reputation for recklessness, the CIA has assessed that he ordered the gruesome murder of journalist Jamal Khashoggi at the Saudi Consulate in Istanbul.

Although bin Salman is more secure in power today than Crown Prince Abdullah was in 1997, his impetuousness constitutes a vulnerability. Sen. Lindsey O. Graham (R-S.C.), normally a strong supporter of Saudi Arabia, has gone so far as to call him “crazy” and “dangerous.” Bin Salman’s rivals at home will take heart as long as he has such strong detractors in the United States, their critical ally. If he is seen as toxic abroad, his eventual succession is not entirely assured.

Bin Salman may realize this vulnerability. Since the Iranian strike on Saudi oil facilities in September, he has pursued a more moderate approach to Iran, requesting third-party mediation to avert further confrontation. Now, following the killing of Iranian Quds Force commander, Maj. Gen. Qasem Soleimani, bin Salman has an opportunity to project himself as a maturing leader and constructive partner for peace, instead of a rash young man careening toward conflict. Like Abdullah before him, he should double down on his attempt to defuse conflict with Iran.

This could boost bin Salman in numerous ways: quieting his American detractors, hedging in case of a Democratic presidential victory that revives the Iran nuclear deal and smoothing his eventual succession to the throne. But a Saudi detente with Iran would also be good for the Middle East and the world.