A man in downtown Tehran holds a poster of Mohammad Reza Aref, the leader of a reformist coalition in Iran. The nation’s recent elections dealt a stinging blow to hard-line politicians. Photograph by Majid Saeedi / Getty

Iranians revel in political humor. Over the weekend, as election results began to show that long-entrenched hard-liners were losing, a new joke circulated in Tehran: Foreign Minister Mohammad Javad Zarif had called Secretary of State John Kerry with an offer: “John, we have just succeeded in defeating our hard-liners. Let us know if you want advice on how to beat Mr. Trump.”

Iran’s twin polls—for the Majlis, or parliament, and for the Assembly of Experts, which chooses the country’s Supreme Leader—weren’t quite that straightforward. Before the vote, most reformists were disqualified by the government’s mercurial vetting process. Voters countered by rejecting big-name hard-liners who had blocked reforms at home and tried to stymy the nuclear deal with the outside world. The result is a wave of new faces in Iranian politics; only about a third of the winners are incumbents in parliament. The number of women almost doubled, and younger candidates also won more seats. The largest bloc will be made up of centrists, moderate conservatives, and independents, with a few real reformists (who often won the highest vote counts). Within the revolutionary confines of the Islamic Republic, it was a big deal.

Reformist papers ran banner headlines and huge pictures hailing the victors. “Epic of hope: An unforgettable day,” declared Etemad; Aftab-e Yazd declared, “The Breeze of Victory.” Hard-line papers took a different tack. Many reformists boycotted the last election, so Amin emphasized the sixty-per-cent turnout—“Everyone Came”—as proof that the majority of Iranians had endorsed the political system. Kayhan, the most extreme hard-line paper, charged that President Hassan Rouhani’s backers had created “an illusion of victory.” Its editor, Hossein Shariatmadari, wrote, “The structure of Iran’s ruling system is such that no political faction can change the main polities rooted in core principles.”

In Tehran, all of the city’s thirty seats went to the so-called List of Hope, nominated by the Universal Coalition of Reformists. Even the leading hard-liner, a former speaker of parliament connected by politics and family to Supreme Leader Ali Khamenei, lost his seat. Conservatives and a smattering of hard-liners fared better in the provinces, and will still have a large parliamentary presence. But they lost the guaranteed dominance that they have enjoyed since 2004.

The vote was a major boost for President Rouhani, who has initiated the most serious reëngagement with the outside world since the 1979 revolution. He has also pledged to reform Iran’s ailing economy and increase individual freedoms. “Kudos to the history-making nation of Iran,” he tweeted Monday, on his English-language account. “Let's open a new chapter based on domestic talents & global opportunities.” Now Rouhani has to deliver. He faces reëlection next year.

The election certainly offers no guarantee that Rouhani will make progress navigating Iran’s toxic political environment, but at least the election ousted members of parliament who had repeatedly blocked his initiatives. Some had publicly called Iranian diplomats “traitors,” or vowed to “bury them under cement” for negotiating with the United States. The atmospherics—and the signals from the youth-dominated electorate—reflect an overwhelming interest in shifting course on both domestic and foreign policy.

The election also marked something of a comeback for former President Hashemi Rafsanjani, who orchestrated constitutional changes and economic reforms after the death of the revolutionary leader Ayatollah Ruhollah Khomeini, in 1989. Rafsanjani, nicknamed the Shark for his political skills and his smooth, beardless face, had been marginalized in a power struggle with the current Supreme Leader. In 2000, after serving as President and as parliament’s speaker for almost a decade, he was humiliated in a run for parliament when he lost, disputed the vote, and then withdrew, largely to save political face. In 2005, he lost in another campaign for the Presidency, against the hard-liner Mahmoud Ahmadinejad. And in 2011 he was forced out as chair of the Assembly of Experts by hard-liners. Two of his children—Mehdi and Faezeh, who is also a former member of parliament—were sentenced to jail terms on trumped-up charges. Two other children, Fatemeh and Mohsen, were disqualified from running for parliament in this election.

For this election, Rafsanjani organized a coalition slate for the Assembly of Experts—and won the largest number of votes. His decisive victory could position him to lead the body again. It’s widely believed that he covets the job of Supreme Leader—a lifetime appointment—even though he’s older than the current leader. In an Instagram post this weekend, he wrote, “Competition is over. The era of unity & cooperation is here."

In contrast, the hard-line chairman of the Assembly of Experts, Mohammad Yazdi, lost his seat—not just against one rival but in a field that allocated sixteen slots for Tehran representatives. Mohammad Mesbah-Yazdi, who had been the spiritual mentor to former President Ahmadinejad, was also voted out of office.

Even a prominent hard-liner who managed to hold on to his position faced embarrassment. Ahmad Jannati has been a member of the Guardian Council since 1980 and its chairman since 1988. The Council’s twelve clerics vet all candidates and legislation, wielding enormous power behind the scenes. (It was the Council that disqualified the majority of reformist candidates for this election.) Jannati has simultaneously served on the Assembly of Experts. Yet voters came within a hair of voting him out of the Assembly. He came in sixteenth out of the sixteen seats allocated to Tehran—a stunning rebuke.

One of the most interesting politicians to emerge from the election is Mohammad Reza Aref, who received the most votes of any parliamentary candidate for Tehran. Aref is the leader of the List of Hope, and a former Vice-President and Presidential candidate. He stepped aside, in a field of eight, to help Rouhani, a dark horse, win in 2013. Hard-liners still control the judiciary, as well as the security forces, military, and various intelligence agencies. They are unlikely to cede powers easily. But Rouhani and Aref are now key players—and allies—in two of the three branches of government.

Iranian politics are ever evolving, and, for the outside world, ever confounding. In this election, the sharp edges that have defined internal tensions over the past decade have been dulled. Iranians voters have signalled that they want relief, not more political infighting at home or confrontation with the outside world.