Hard-line factions in Iran suffered unexpected defeats in the first major electoral test for President Hassan Rouhani since he struck a nuclear deal, boosting prospects for his outreach to the West and bid to ease social restrictions.

Election day Friday was a humiliating day for hard-liners as Iranians voting in twin contests loosened the factions’ decade-long grip on power.

In results announced Monday, a moderate-reformist coalition swept all 30 seats in Tehran for the 290-seat parliament, with the remainder still nearly a 2-to-1 pro-Rouhani advantage and 59 seats subject to a runoff.

Pro-Rouhani ayatollahs also won 15 of the 16 Tehran seats in the Assembly of Experts, squeezing out two hard-liners in the 88-member clerical body that will choose the next supreme leader.

Despite a host of handicaps, from mass disqualifications to a media blackout on top reformist leaders, a moderate-reformist coalition managed to maximize the result in their favor – giving a symbolic win that will enable Mr. Rouhani to pursue with greater determination his agenda of reaching out to the West and enhancing personal freedoms at home.

“The hard-liners called them every name they could think of – traitors, followers of the British, seditionists. The very clear message they sent was, ‘Give up hope, this is our game,’” says a veteran political analyst who asked not to be named.

“Against all the odds, moderates and reformists orchestrated unity out of differences, something Iran has been missing for a long time,” says the analyst, about voting blocs created with candidates from across traditional political lines. The moderate-reformist bloc for Tehran, for example, included maverick conservative Ali Motahari, who has called for the release from house arrest of reformist leaders, and who won the second highest vote count in the capital.

“It’s too soon to say if it is a benchmark, of not sticking to your own faction,” says the analyst. “But that idea of being strictly reformist or conservative is broken.”

The result “showed that people went to give the vote emotionally out of a kind of fear, because they believed that [hard-line] camp was a threat to them, to their hopes and their wishes,” says Amir Mohebian, a conservative editor and analyst. “Maybe people don’t love – maybe they hate – the people who attacked the nuclear deal."

Leading that charge was former President Akbar Hashemi Rafsanjani and Mr. Rouhani, who scored highest in the Assembly of Experts, in a vote that rejected hard-line ayatollahs Mohammad Yazdi, the incumbent chairman, and Mohammad Taghi Mesbah-Yazdi, the spiritual icon of Iran’s most hard-line factions.

Just 10 days earlier, Iran’s supreme leader, Ayatollah Ali Khamenei, had praised those two clerics, as well as hard-line Ayatollah Ali Jannati, who barely clung to his seat.

On voting day, Mr. Khamenei called on a mass vote to “ruin the hope of the enemies,” and with 60 percent turnout nationwide, on Sunday he praised the “glorious participation” of Iranians, “victorious in another great examination.”

Mr. Rafsanjani also hailed the result. “No one is able to resist against the will of the majority of the people and whomever the people don’t want has to step aside,” he said Sunday.

Conservative newspapers largely ignored the moderate sweep in Tehran. The headline of the hard-line Kayhan newspaper read: “Parliament remains revolutionary,” with the sub-headline that the “Death to America” slogan “will stay in parliament.”

Channels on Telegram, an increasingly popular messaging app, went much further, with one run by Iran’s ideological Basij militia asserting that Tehran had “said ‘no’ to the leader,” and that Qods Force commander Qassem Soleimani should “not send anyone to [fight in] Syria from Tehran,” implying that they could not be trusted.

Addressing Tehranis, one post read: “If [Islamic State] comes to Tehran, you defend it yourself.”

But not all conservatives were angry about the result. One hard-line official, who served as a security guard during the tumultuous 1979 return from exile of Iran’s revolutionary leader Ayatollah Ruhollah Khomeini, said he was impressed with the election result and how interconnected Iran’s youth are today by social media, noting especially Telegram and Facebook.

Get the Monitor Stories you care about delivered to your inbox. By signing up, you agree to our Privacy Policy

“They are so much more aware than we were,” says the official, who could not be named, but noted that his under-30 son was active in the technical side of the running of the vote.

“I say from the bottom of my heart, these youth today are more revolutionary than we were. They are active in the field themselves.”