Ebrahim Raisi, a hardline Islamist judge and a protégé of Ayatollah Ali Khamenei, Iran’s supreme leader, has comfortably won presidential elections. But his ostensible landslide looks to be a Pyrrhic victory, gathering nothing like the popular support needed to guide Iran through one of its worst crises since the 1979 revolution that created the Islamic Republic.

If this was a test of Iranians’ trust in their hybrid and hydra-headed system, where theocrats and vested interests led by the supreme leader hold the whip hand over popularly elected institutions such as parliament and the presidency, it failed.

Turnout of 48.8 per cent was the lowest in the Islamic Republic’s history of contested presidential elections. The outgoing president, Hassan Rouhani, was re-elected with 24m votes in 2017; Raisi got 18m. Not only did more than half of Iranians spurn the poll, 3.7m spoiled their ballots — more than voted for either of Raisi’s feeble rivals, after theocrats banned viable candidates.

Iran’s disgruntled majority, in other words, opposes Raisi. The aspirations of an ancient civilisation but young population to rejoin the world, which crystallised in Rouhani’s two victories, can no longer find expression in elections where the result is preordained by Khamenei and the clerics.

This is a problem Raisi will have scant time to ponder. Iran’s economy lies prostrate after former US President Donald Trump withdrew from the 2015 bargain Iran struck with the US and five other world powers to mothball most of Tehran’s nuclear programme. He reimposed possibly the harshest sanctions ever levied on a sovereign state. While Trump’s “maximum pressure” campaign failed to bring Iran to its knees, it worked well politically for the hardliners who used it as proof the US was not to be trusted.

Yet leaders like Khamenei and Raisi cannot be complacent. Iran has experienced regular insurrection at home, and is struggling abroad to control what was envisaged as an axis of power but is now a chain of collapsing states in Iraq, Syria, Lebanon and Yemen. This is especially true after the assassination of Qassem Soleimani, commander of the Revolutionary Guard’s foreign legion, in Baghdad last year.

There are problems with someone like Raisi in the presidency, a cleric who headed the judiciary over the past two years. He is alleged to be linked to the executions of thousands of political prisoners in 1988, a subject he has avoided while reinventing himself as a populist anti-corruption campaigner. Unlike Rouhani, architect of the 2015 nuclear deal, he is under US sanctions.

President Joe Biden is trying to resurrect the accord, and roll back Iran’s enriching of uranium. Iran wants guarantees against US sanctions that deterred foreign investors with possible eviction from the dollar system, despite the nuclear accord. It also wants the IRGC, a state body designated a terrorist group by Trump, delisted. Yet IRGC leaders head paramilitary operations in the Middle East and have a lock on Iran’s economy.

A conservative regime in Tehran, with theocrats and elected officials on the same page, arguably makes the nuclear talks easier — especially if a revamped deal is signed off under Rouhani, and the benefits accrue under Raisi. But Iran needs money and the US and its allies will not lift all sanctions unless Tehran changes its behaviour in neighbouring Arab countries.

The record shows, moreover, that Iranian society, young, urban and connected, will push back against the ayatollahs until someone opens a new vista of hope. This deeply flawed election has not settled the political landscape.