THEY came to praise him and to bury him. The eminent former butts of his criticism filled the front rows of his funeral and showered him with accolades. Ayatollah Akbar Hashemi Rafsanjani was the architect of Iran’s revolution, they said, who protected it during the Iran-Iraq war, and rescued it from economic siege afterwards. Ayatollah Ali Khamenei, Iran’s supreme leader, with whom he spent two decades sparring, tweeted that he was “his old friend and comrade”, and read the last rites. Fellow clerics organised the biggest funeral since Ayatollah Khomeini’s, assigned him a golden tomb next to the revolution’s founder, and promised to name a street after him. They closed schools and broadcast the ceremony live. Over 2m Iranians attended, said the authorities.

The hardliners now hope that at last Mr Khamenei can be truly supreme. Already rejoicing in friendly Russia’s growing presence in the region, and the prospect of victory in Syria, the hardliners will finally also gain control of the powerful Expediency Council that Mr Rafsanjani led for 28 years, a recurrent thorn in their sides. Helpfully, the security forces have ensured that the late Mr Rafsanjani had no one to pass his mantle to. Mir Hossein Mousavi and Mehdi Karroubi, the two presidential candidates he backed against the anti-Westernising Mahmoud Ahmadinejad, are safely under house arrest.

They have also silenced Muhammad Khatami, his reformist successor as president, banned his name from the media, and barred him from attending the funeral. Hassan Rouhani, though the current president and also a protégé, is too cautious and, as a former intelligence officer, too much a plodding functionary, to defy the establishment alone. Under Mr Khamenei’s watchful eye, he will now be a safe bet for re-election in May.

Still, Mr Rafsanjani’s appearances always had an uncomfortable habit of veering off-message. From the covered courtyard of Tehran University in 2009, he challenged the authorities to heed the people’s voice, when they massaged the vote to award Mr Ahmadinejad a second term and opened fire on protesters. “We need an open society in which people can say what they want,” he preached. “We should not imprison people.”

Eight years later, even though he now lay in a casket, his supporters took up the refrain. From the back of the same courtyard came the cries of dissent. Some donned green wristbands and T-shirts, sporting the colour of the protest movement, and chanted “Hail, Khatami”. Others replaced the hardliners’ mantra of “Death to America” with “Death to Russia”, just as they had in 2009 when Russia’s president had been the first foreign leader to congratulate Mr Ahmadinejad on his re-election. Eventually the sound technicians drowned out the dissenters with mourning music.

In a sense both requiems were right. Ayatollah Rafsanjani was both a pillar of Iran’s theocratic establishment and its prime critic. He both fuelled criticism and harnessed it within acceptable parameters. But for his manoeuvring, many more disgruntled Iranians might have abandoned the doctored electoral process and sought other means to voice dissent. The merchant classes would have despaired of the possibility of normal trade with the West. And the clerics in the holy city of Qom, who shy from mixing Islam and politics, would more vociferously have questioned the legitimacy of the Islamic Republic. “We thought that he would be the one who could secure the transition to a more moderate pro-Western regime,” says a young mourner in shock at his passing.

For a moment this week, Mr Rafsanjani brought Iran’s contradictory forces together. All thronged to his funeral, and—remarkably in the Middle East—kept it peaceful. But maintaining that common ground without the centrist may be harder. Rulers and ruled will have fewer restraints. Protesters could increase their demands for the release of opposition leaders; hardliners might sense a freer hand to suppress them. The wounds that Mr Rafsanjani helped bind while alive risk being reopened.