Donald Trump arrived in Saudi Arabia this weekend to launch a new Middle East coalition designed to confront Iran, just as Tehran announced the reëlection of President Hassan Rouhani, the man who dared to engage diplomatically with the United States. Rouhani won a commanding victory: fifty-seven per cent in a four-way race, with seventy-per-cent turnout. He fended off a challenge from a populist right-wing cleric, Ebrahim Raisi, a rising political star backed by hard-line power centers such as the Revolutionary Guards. Street celebrations erupted Saturday night from Tehran to Mashhad, the eastern city with Iran’s holiest shrine.

President Trump’s trip symbolizes a formal U.S. reversal on Iran. There is no foreign-policy issue over which Trump and former President Barack Obama disagree more. Trump’s mobilization of Sunni Arab regimes to challenge predominantly Shiite Iran risks increasing regional and sectarian tensions in the energy-rich Gulf. New sanctions, some imposed last week by the White House and others in the pipeline in Congress, threaten to undermine the spirit of diplomacy created during two years of arduous negotiations between Tehran and the world’s six major powers. It produced a deal, in 2015, containing Iran’s nuclear program—the most important nonproliferation treaty in more than a quarter century.

At a press conference in Riyadh on Saturday, Secretary of State Rex Tillerson did not rule out talking with the Iranian foreign minister, Mohammad Javad Zarif. “I’ve never shut off the phone to anyone that wants to talk or have a productive conversation,” he said. “At this point, I have no plans to call my counterpart in Iran, although, in all likelihood, we will talk at the right time.”

But Tillerson and his Saudi counterpart bluntly outlined their deepening alliance to check Iran’s influence in the region. They demanded that Iran cease its support for terrorist groups, dismantle its ballistic-missile program, and end interventions in Syria, Iraq, and Yemen. “What I would hope is that Rouhani now has a new term, and that he uses that term to begin a process of dismantling Iran’s network of terrorism, dismantling its financing of the terrorist network, dismantling of the manning and the logistics and everything that they provide to these destabilizing forces that exist in this region,” Tillerson said. “We also hope that he restores the rights of Iranians to freedom of speech, to freedom of organization, so that Iranians can live the life that they deserve.”

For Iranians and the outside world, the stakes in Iran’s Presidential election were not just who holds office for the next four years or the nuclear deal. The outcome will also influence the future direction of the revolution at a time when its original masterminds are aging, ailing, or dying off. Supreme Leader Ali Khamenei, himself a former President, turns seventy-eight this year; he had surgery for prostate cancer in 2014. When he dies, the President is one of three officials in a temporary council that assumes his powers until a replacement is elected by the Assembly of Experts. Both Rouhani and Raisi are elected members of the Assembly. Both are considered contenders for the job.

Since the 1979 revolution, the core political debate in Iran—which has played out in every major domestic- and foreign-policy decision—has centered on whether the Islamic Republic of Iran, its formal name, is first and foremost an Islamic state or whether its priority is republican. Iran’s revolutionary constitution is based on French and Belgian law, with layers of parallel laws and institutions designed to comply with Islamic traditions. Reformers and centrists have sought, in varying degrees, to open up Iran again, by relaxing some of the rigid Islamic strictures and engaging with the outside world. The revolution’s early creed was “Neither East nor West.”

Hard-liners fear abandoning the country’s Islamic identity, politically and socially. At a graduation ceremony for Revolutionary Guard cadets this month, Khamenei warned that candidates “should demonstrate in their campaign promises and remarks that the concern is ‘national glory and independence of the Iranian nation.’ The Iranian nation is a revolutionary nation. The glory of the nation must be protected.”

Iran’s elections are heavily controlled. More than sixteen hundred candidates—including a record hundred and thirty-seven women—registered to run. Their credentials are vetted by the Guardian Council of twelve religious scholars. Only six passed muster. Among those disqualified was the former President Mahmoud Ahmadinejad. Yet the campaign, including three televised political debates, was lively and occasionally even combative. Rouhani scolded hard-liners, even the Revolutionary Guards.

“We’ve entered this election to tell those practicing violence and extremism that your era is over,” Rouhani said, on May 8th. “The people of Iran shall once again announce that they don’t approve of those who only called for executions and jail throughout the last thirty-eight years.” The thirty-eight years is a reference to Raisi, a former Attorney General and one of four judges who served on a panel linked to the execution of thousands of political prisoners in 1988.

The majority of Iran’s voters today were born after the revolution. Their religious zealotry has been tamed by technology, access to information, social media, and education. Iran won a U.N. award for closing the gender gap in education; the majority of its university population is now female. The post-revolutionary generation was the biggest factor in electing Rouhani in 2013. He campaigned on a dual pledge to broker a deal with the United States and five other major powers on Iran’s nuclear program and to end sanctions that had crippled the economy. The same generation put him back in office by even larger numbers—some four million—this weekend.

“More and more Iranians are coming to the conclusion that if they want a change in society, they have to participate in the political process,” Nasser Hadian, a political scientist at the University of Tehran, told me on Saturday. “That’s the best way to solve our disputes.”

In a post-election speech, Rouhani said, “Our nation’s message in the election was clear: Iran’s nation chose the path of interaction with the world, away from violence and extremism.”

The challenge will be to deliver the many reforms, some of them modest, that he promised during his first term, even with the coöperative parliament that was elected last year. Rouhani will face serious obstacles from disproportionately powerful hard-liners who control the intelligence, security, military, and judicial arms of government. They have leveraged their ability to detain or try activists, dissidents, reformists, and foreigners in order to embarrass or discredit the President.

Running for the Presidency or holding the office is actually quite dangerous in Iran. Two candidates in the disputed 2009 Presidential election have been under house arrest for six years. The former Prime Minister Mir-Hossein Mousavi and the former Parliamentary Speaker Mehdi Karroubi were both early revolutionaries. Mousavi is widely credited with helping Iran survive through the costly eight-year war with Iraq. Their defeat in 2009 sparked the Green Movement uprising, when millions took to the streets of cities across Iran to protest alleged voter fraud in the reëlection of Ahmadinejad. It was the largest challenge to the regime since the 1979 revolution. It sputtered on for six months, until a nationwide crackdown that included mass detentions and Stalin-esque trials.

Presidents of all political positions have been targeted. The former President Mohammad Khatami, who held office from 1997 until 2005, has been banned from appearing in public, being quoted in the media, or travelling abroad. He has defiantly used social media to communicate, including an endorsement of Rouhani. Two of the children of the former President Hashemi Rafsanjani have been sentenced to jail terms. His daughter Faezeh Hashemi, a former member of parliament, was imprisoned for six months, in 2012, for propaganda against the regime; his son Mehdi Hashemi is still serving a ten-year sentence for national-security and financial crimes. Ahmadinejad has been rejected politically by those who helped him win reëlection, in 2009. One of his Vice-Presidents (each President has several) was sentenced to five years for embezzlement, and another was questioned about corruption.

After his landslide win, Rouhani has to deliver, particularly on economic issues—many of which are tied indirectly back to U.S. foreign policy. They were the biggest issues of the campaign, as many Iranians feel that they have not gained the anticipated benefits from the Joint Comprehensive Plan of Action ( J.C.P.O.A.) nuclear deal and the lifting of many sanctions. In one election poll, eighty-three percent of those surveyed said unemployment, the high cost of living, the gap between rich and poor, and other economic issues were the country’s most urgent problems. More than half said that the economy was getting worse.

In 1979, the revolutionary leader Ayatollah Ruhollah Khomeini famously quipped that the revolution was about “justice and independence,” not “the price of watermelons.” He said that economics was only “for donkeys.” Four decades later, the early revolutionaries are discovering that the price of watermelons—the issues of a normal state—can determine their fate. And having a hostile superpower determined to squeeze Iran harder, whether by empowering regional rivals or imposing new sanctions, will not make normalizing the Islamic Republic any easier.