Former Iranian president Ali Akbar Hashemi Rafsanjani, one of the most influential figures in Iran since the Islamic revolution and a driving force for reform, has died at the age of 82 after suffering an apparent heart attack, state media reported Sunday.

Though his power had waned since he served two terms as president from 1989 to 1997, Rafsanjani retained significant clout on the Assembly of Experts that will choose a successor to Supreme Leader Ayatollah Ali Khamenei, who is 77 and has been treated for prostate cancer. Rafsanjani’s absence also could have an impact on presidential elections in May, when President Hassan Rouhani, who is considered a pragmatist, will seek reelection.

Rouhani, a protege of Rafsanjani, reportedly rushed to the hospital in Tehran where Rafsanjani was taken Sunday morning. He was seen leaving in tears.

As president, Rafsanjani developed a reputation for being ruthless and brutal, and his critics charged he had a hand in the murder of numerous dissidents. Argentine prosecutors suspected Rafsanjani was among Iranian officials involved in the bombing of a Jewish center in Buenos Aires in 1994 that killed 85 people. But in later years, he became known as a champion of reformists who were otherwise marginalized from power.

His death leaves a huge vacuum among moderate Iranians who seek reforms in the country’s political life and economic and cultural openings to the West. His funeral will be held Tuesday, and analysts will be looking for clues to whether marginalized reformists will be galvanized to unite or hard-liners will consolidate their power.

“It’s a loss for the pragmatist and reformist camp,” said Barbara Slavin, acting director of the Future of Iran Initiative at the Atlantic Council. “How big a loss depends on when Khamenei dies, and where Iran is. It depends on where relations stand with the United States and the international community, whether we’re back to a period of hostility or whether the nuclear deal survives and there’s a kind of detente with the U.S. And we won’t know that until our own new president takes office and puts his policies into effect.”

Rafsanjani was one of the founding fathers of Iran’s Islamic republic and an aide to Ayatollah Ruhollah Khomeini, the leader of the 1979 revolution. He was involved in the secret negotiations between Iran and the United States in the 1980s that led to the Iran-contra scandal. Those talks were one of several Rafsanjani efforts to find a way to mend relations with Washington ruptured by the prolonged holding of hostages in the U.S. Embassy in Tehran.

Rafsanjani also had a hand in founding Iran’s nuclear program. But he supported Rouhani’s negotiations with six world powers to scale back the capability to build nuclear weapons, in exchange for the easing of international sanctions that shackled Iran’s economy. As recently as last month, he was appealing to international investors, assuring them of the financial protections that they found lacking.

State-run television announced that Rafsanjani had died “after a lifetime of fighting and constant efforts in line with fulfilling the goals of Islam and the revolution.”

During his life, Rafsanjani was a controversial figure. As president, he was reviled by many Iranians, who considered him corrupt because of suspicions that he had used his position to enrich his family. He and his intelligence services were also implicated in the assassinations of dissidents in Iran and Europe, as well as in terrorist attacks on civilians.

“Although Rafsanjani has long been identified as a pragmatist, he was an integral part of the Islamic republic’s security apparatus, one which tortured dissidents, conducted foreign assassinations and terrorist attacks, and helped cover the Iranian nuclear program in a shroud of secrecy while soliciting foreign assistance and material,” said Behnam Ben Taleblu, an Iran analyst with the Foundation for Defense of Democracies.

But in the eyes of many reformists, Rafsanjani redeemed himself when he supported the Green Movement after the 2009 election that was contested by protesters demanding the removal of President Mahmoud Ahmadinejad.

“Since 2009, he was the center of gravity for reformist and moderate forces,” said Hadi Ghaemi, head of the New York-based International Campaign for Human Rights in Iran. “Now, in a way, they have lost their godfather.”

Rafsanjani played a key role in Rouhani’s election, even leading Rouhani into parliament by the hand the first time he visited as president. Rouhani is often mentioned as a potential successor to become supreme leader once Khamenei dies. But the assumption was that Rafsanjani would be alive to help make that happen.

“His chances of winning this power struggle without Rafsanjani pulling for him in the background is now reduced,” said Trita Parsi, head of the National Iranian American Council.

Rafsanjani was born in 1934 to a family of farmers in central Iran and studied theology in Qom with Khomeini. During the 1960s and 1970s, he took part in the Islamic student movement opposing Shah Mohammad Reza Pahlavi, leading to Rafsanjani’s imprisonment several times.