When Ebrahim Raisi first contested Iran’s presidency in 2017, the sombre conservative cleric lost badly, failing to win over aspirational voters who had pinned their hopes on the republic’s nuclear deal to open up the country.

Four years on, the collapse of the 2015 accord Iran signed with world powers, a withering economic crisis triggered by US sanctions, disillusioned voters and the regime’s determination to have a hardliner back in office paved the way for his election victory with 62 per cent of the vote.

But to many inside and outside the republic his win bears the marks of a pyrrhic victory.

More than half of voters chose not to cast a ballot in what reformers described as a rare act of civil disobedience. Turnout of 48.8 per cent was the lowest in the Islamic republic’s history, and 3.7m people chose to spoil their ballots, more than voted for either of Raisi’s rivals.

“The election’s message is that the dissident faction is much bigger than Raisi’s supporters,” said Hossein Yazdi, a reformist activist.

Many of those who stayed away from polling stations assumed the result was preordained after the authorities barred leading reformist candidates from standing. It was widely assumed that Raisi, the judiciary chief, was backed by Ayatollah Ali Khamenei, the supreme leader, with hardliners using the election to regain control of all the important branches of the state for the first time in almost a decade.

Analysts said Raisi’s victory increased his chances of succeeding the 82-year-old Khamenei as supreme leader on his death. But only if he can navigate the challenges he is inheriting — an economy battered by sanctions and coronavirus, and a polarised society that is vulnerable to unrest.

His supporters hope he can end the factional infighting that has blighted the regime during President Hassan Rouhani’s second and final term, which finishes in August. Unity within the theocratic system, which has competing centres of power, and a smooth succession are deemed Khamenei’s priorities. These aims have become more pressing as the republic has endured its most turbulent period since the Iran-Iraq war in the 1980s.

“One nation, one team, one goal,” was one of Raisi’s election slogans.

“I believe in Raisi because he’s 100 per cent in line with the leadership,” said a regime insider. “The parliament, the leadership, the judiciary — they will all be in line and perform better.”

The catalyst for Iran’s recent malaise was Donald Trump’s decision to pull the US out of the nuclear accord. He imposed crippling sanctions on the republic and individuals including Raisi, strangling Iran’s ability to export oil and plunging it into recession.

The turmoil emboldened hardliners and crushed the dreams of the 24m Iranians who had voted for Rouhani in 2017 in the hope that the nuclear deal would usher in change and prosperity.

Their disillusionment played into Raisi’s hands. His conservative constituency heeded its leaders’ calls to vote, while reformists stayed at home.

So although he technically won a landslide, he faces serious challenges without the strong popular mandate of his predecessors.

“Raisi has entered into a game which he will lose. In the public’s eyes, rightly or wrongly, his victory was pre-determined,” said a reformist analyst. “This makes people angry.”

Others fear hardliners will seek to further marginalise and oppress pro-democracy activists.

“Without any doubt there will be suppression of pro-democracy people,” Yazdi, the activist, said.

There have long been concerns about Raisi’s human rights record. Now it threatens to tarnish his credibility at home and abroad while Tehran is negotiating with world powers to reach an agreement to bring the US back to the nuclear accord and lift sanctions.

President Joe Biden has said he will rejoin the accord if Iran fully complies with the deal. But the new government will be led by a man whom the Trump administration accused of overseeing executions, “torture and other inhumane treatment of prisoners” when it imposed sanctions on Raisi in 2019.

He is alleged to have been linked to the execution of thousands of political prisoners when he was a state prosecutor in the late 1980s. He has not commented on that period.

Born to a clerical family, Raisi’s path to the top became evident five years ago when Khamenei named him as custodian of the Imam Reza shrine in his home city of Mashhad, a powerful position overseeing Iran’s holiest site.

After Khamenei appointed him head of the judiciary, one of the main centres of hardline power, in 2019, he used the post to launch a crusade against corruption that earned him plaudits, even among some of his critics. Others, however, viewed the move as the relaunch of his political ambitions.

During the election campaign, he offered few policy details, but said domestic issues were his priority. He sought to appeal to Iranians who have suffered economic hardship, at times referring to his own modest upbringing.

“I’ve not only known poverty, I’ve tasted poverty,” was a phrase he repeated.

He has made only fleeting references to foreign policy and few expect significant changes, whether it be to Iran’s hostile relations with the US, its support for regional militant groups or expanding its missile programme.

Unlike Rouhani, Raisi has had little overseas exposure, and regional policy and big security decisions are made by Khamenei.

Analysts add that he will probably be less overtly radical than Mahmoud Ahmadi-Nejad, Iran’s last hardline president. His first term was characterised by bombastic tirades against the US and Israel and costly, populist domestic policies that sparked economic chaos.

But even conservatives acknowledge that Raisi faces a daunting mission.

“It’s not unlikely that Raisi’s term becomes similar to Ahmadi-Nejad’s and Rouhani’s [chaotic last years],” said Mohammad Mohajeri, a conservative analyst. “The boat of politics in Iran rocks a lot.”