Iran's Supreme Leader, Ayatollah Ali Khamenei is right to be concerned about the loss of one of the leading members of Iran's religious establishment in an election year. "With the loss of Hashemi," he said on Sunday referring to the late Ayatollah Akbar Hashemi Rafsanjani, "I know no other personality with whom I had such a common and long-term experience in the peaks and valleys of this historic era."

Rafsanjani would also be sorely missed by President Hassan Rouhani, who is facing an election race in June with hardliners intent on sidelining him and undermining his achievements on Iran's nuclear deal with the West. It was with Rafsanjani's support that he won the 2013 elections.

The weeks and months ahead and the forthcoming presidential elections are crucial, not necessarily for the survival of the Islamic Republic, but for the continued ability of the Supreme Leader to hold the unity of the theocratic establishment intact, especially given that he is not in good health himself.

A controversial figure

More than anything Rafsanjani was a pragmatic centrist who kept the Islamic Republic intact by sticking to the political middle ground. There may be other well-known centrists, but none were as powerful or as influential. He was also one of Iran's richest men who maintained close links to Iranian industry and business throughout his life.

Iran's president from 1989 to 1997, the speaker of the parliament from 1980-1989, chairman of the Expediency Council, and elected Speaker of the Assembly of Experts, Rafsanjani was long considered to be one of the most corrupt and yet most powerful men in the Islamic Republic. He had many enemies too who accused him of involvement in the murders of opposition at home and abroad.

Ordering a full state funeral and personally saying the final prayers, Khamenei clearly indicated that full respects have to be paid to Rafsanjani, who he had isolated for the last eight years of his life. In the contested presidential elections of 2009, Khamenei ignored Rafsanjani's advice to listen to the demonstrators and refrain from imprisoning them.

OPINION: Rafsanjani and Khamenei - the Rouhani element

Despite their differences, Khamenei was always fully aware that Rafsanjani was the main bulwark of the Islamic Republic against potential violent shake-ups. It wasn't just his persona, with an aura of maturity and calm, but the unrivalled network of operatives he recruited in all corners of the political structure at home and abroad. They designed and shaped the Islamic Republic under his guidance.

In the absence of Rafsanjani, it is doubtful that Khamenei and his hardline supporters in Iran's Revolutionary Guards Corp (IRGC) or the fundamentalist clergy can maintain the political balance that is so crucial to the survival of the Islamic Republic.

With Rafsanjani gone it is not clear whether Khamenei would support Rouhani in his exchanges of accusations of corruption with the hardline judiciary, or over the Iran deal if it were to be jeopardised by the US president-elect Donald Trump. Rafsanjani was the main force behind talks with the West and it was through his influence that Rouhani took the initiative.

"It's a loss," says a seasoned European diplomat who prefers not to be named, "particularly now in the times of unpredictability and flux concerning Iran and the region." Rafsanjani was known to have good relations with senior Saudi officials and "was seen as a key figure who could have resolved rising tensions between the regional rivals in the coming years".

The reformist leadership

Rafsanjani's departure would also weaken Iran's reform movement which has taken a serious battering since the 2009 presidential elections.

He fell out with the reformist president, Mohammad Khatami, during the reformist era of 1997-2005.

Yet, since the 2009 mass demonstrations, Rafsanjani proved to be on the side of the reformists calling publicly for greater freedoms. He did so at the price of falling out with the supreme leader, thus getting sidelined, accused of "sedition" and even forbidden from leading Friday prayers.

Rafsanjani was undeterred. He kept a low profile, but his network of operatives gave effective support to Rouhani's win in the 2013 presidential elections. In the 2016 parliamentary elections, he managed to push through tens of reformist and moderate members into the parliament and most of the Tehran seats in the Assembly of Experts.

Now with Rafsanjani gone, it is up to the reform leaders such as Khatami, Mehdi Karroubi and Mir-Hossein Mousavi to try and keep that momentum going. This would be very difficult, however, as the three are silenced and the latter two are still under house arrest. Khatami was reportedly not even allowed to attend Rafsanjani's funeral.

This leaves President Rouhani as the only moderate political leader who can fill in that crucial political centre: that balance between the right with which he has worked closely as the secretary of the Supreme National Security Council 1989-2005 on the one hand, and the reformists, who are his newly found friends, on the other. His slogans of moderation would suit this path and if he moves wisely he could remain close to the supreme leader and take advantage of the vacuum created by Rafsanjani's departure.

Massoumeh Torfeh is the former director of strategic communication at the UN Assistance Mission in Afghanistan and is currently a research associate at the London School of Economics and Political Science specialising in Iran, Afghanistan and Central Asia.

The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.