TEHRAN, Iran — Former Iranian president Akbar Hashemi Rafsanjani died in the hospital on Sunday, after suffering a heart attack, the ISNA and Fars news agencies reported.

Rafsanjani, who was 82, was a pivotal figure in the foundation of the Islamic republic in 1979, and served as president from 1989 to 1997.

Often described by Western media as a moderate in Iranian politics, he was a vicious critic of Israel, which he last year called a “forged” and “temporary” entity.

Get The Times of Israel's Daily Edition by email and never miss our top stories Free Sign Up

In 2000, he spoke of a single nuclear bomb, attained by the Islamic world, having the capacity to wipe Israel out: “If one day, a very important day, of course, the Islamic World will also be equipped with the weapons available to Israel now, the imperialist strategy will reach an impasse, because the employment of even one atomic bomb inside Israel will wipe it off the face of the earth, but [such a bomb] would only do damage to the Islamic World. It is not unreasonable to consider this possibility.”

Rafsanjani had been admitted to the Shohadaa Hospital in northern Tehran, one of his relatives, Hossein Marashi, was quoted as saying by the agencies.

Rafsanjani was born on August 25, 1934, in the village of Nough, in southern Iran into a wealthy family.

He studied theology in the holy city of Qom before entering politics in 1963, after the shah’s police arrested the founder of the Islamic republic, Ayatollah Ruhollah Khomeini.

A confidant of Khomeini, Rafsanjani was the speaker of parliament for two consecutive terms until Khomeini’s death in 1989.

Rafsanjani’s presidency, a breathing space after the end of the 1980-1988 Iran-Iraq war, was marked by reconstruction, cautious reform and repairs to Iran’s relations with its Arab neighbors.

But it was also marred by human rights violations, rampant inflation and difficult relations with Europe, not least with Britain, after the “death sentence,” or fatwa, handed down to writer Salman Rushdie by Khomeini.

After serving a maximum two consecutive terms, Rafsanjani played an important role in the election of the reformist Mohammad Khatami, who succeeded him as president from 1997 to 2005.

Rafsanjani sought a return to the presidency in 2005, but lost to hardliner Mahmoud Ahmadinejad, in a conservative backlash.

It was a bitter defeat, but rather than retreating from public view, he remained in the limelight.

Rafsanjani emerged as a moderate counter-figure to the ultra-hardliners clustered around Ahmadinejad — under whom Iran’s relations with the West plummeted — and criticized the crackdown that followed Ahmadinejad’s disputed re-election in 2009.

In recent years though, his influence within state institutions had waned.

In 2013, his candidacy for the presidential election was rejected because of his advanced age.

The next year, he delivered crucial support for the eventual winner, Hassan Rouhani, a moderate with whom he had a warm rapport.

He was an important backer of the deal Rouhani struck with world powers for sanctions to be lifted in exchange for curbs on Iran’s nuclear program.

Rafsanjani was always a member of Iran’s top clerical body, the Assembly of Experts, charged with appointing — and if required dismissing — the country’s supreme leader.

Rafsanjani chaired the influential committee for several years.

He also held the chairmanship of Iran’s main political arbitration body, the Expediency Council, since 1990, when he was appointed by Khomeini’s successor as supreme leader, Ayatollah Ali Khamenei.