Image copyright EPA Image caption Mr Rafsanjani was disqualified when he tried to run for president again in 2013
Iran's ex-President Ali Akbar Hashemi Rafsanjani, a dominant figure in the country's politics since the 1980s, has died at the age of 82, media say.
Mr Rafsanjani had suffered a heart attack, the reports said.
He served as president from 1989 to 1997 but lost to Mahmoud Ahmadinejad when he ran again in 2005.
Although Mr Rafsanjani was part of the religious establishment, he was regarded as a "pragmatic conservative" open to improving ties to the West.
His final role was head of the Expediency Council, which tries to resolve disputes between parliament and the Guardian Council, but his power had now waned.
It was the 12-member council, a dominant force in Iran that interprets the constitution, that had disqualified Mr Rafsanjani after he entered the race for the 2013 presidential election as a reformist candidate.
Image copyright EPA Image caption Mr Rafsanjani had warm relations with President Hassan Rouhani (L)
Mr Rafsanjani denounced the move as "ignorant", saying: "I don't think the country could have been run worse."
He then gave his support to the victorious candidate, Hassan Rouhani, who ran on the slogan "moderation and prudence" and attracted the suspicion of hardliners.
The two men were said to have had a warm relationship and Mr Rouhani was seen at Tehran's Shohada Hospital shortly before the death was announced. A crowd reportedly gathered at the hospital after the announcement.
Blow to reformists? Parham Pourparsa, BBC Monitoring
The sudden death of the veteran pragmatist politician will be a major blow to President Rouhani. The president, who is preparing himself for re-election in May, has lost a valuable ally and influential figure who was a founding father of the Islamic Republic.
This explains why Mr Rouhani was the first top official to attend the hospital where Mr Rafsanjani died. Reports say Mr Rouhani was in tears.
Since the 2013 presidential election, Mr Rafsanjani has fully backed Mr Rouhani. Mr Rafsanjani was also a staunch supporter of the landmark 2015 nuclear deal with world powers.
But in Iran's complicated political landscape, his death could also mobilise pro-Rouhani moderates and reformists ahead of the election.
After his defeat in 2005, Mr Rafsanjani became openly critical of President Ahmadinejad.
In 2009, he sided with reformers who disputed that year's elections, although the hardline Mr Ahmadinejad won a second term.
Image copyright AFP Image caption Son Mehdi Hashemi Rafsanjani was jailed in 2015
Mr Rafsanjani was among those calling for the release of political prisoners and greater political freedoms for parties prepared to work within the constitution.
Some of the members of Mr Rafsanjani's family have also made the headlines. His daughter, Faezeh Hashemi, attracted the ire of hardliners when she met a leader of the Bahai religious minority - which Iran's leadership regards as a heretical sect - last year.
And his son, Mehdi Hashemi Rafsanjani, was jailed in 2015 after being convicted of "security offences and financial crimes".
Commander-in-chief
Ali Akbar Hashemi Rafsanjani was born in 1934 in south-eastern Iran to a family of farmers.
He studied theology in the holy city of Qom with Ayatollah Khomeini - who went on to lead the Islamic revolution of 1979 - and was imprisoned several times under the Shah.
In the last year of the 1980-88 war with Iraq, Ayatollah Khomeini appointed him acting commander-in-chief of the armed forces.
He was seen as the main mover behind Iran's acceptance of the UN Security Council resolution that ended the war.
The state-run Irinn network announced on Sunday that Mr Rafsanjani had "passed away after a lifetime of fighting and constant efforts in line with fulfilling the goals of Islam and the revolution".
Akbar Rafsanjani em 2015. 

O antigo presidente do Irã(o), Akbar Hashemi Rafsanjani, morreu no hospital em Teerã(o), capital do país, após um ataque cardíaco. A morte do antigo presidente iraniano aconteceu na noite de domingo (8 de Janeiro), mas só divulgada pela televisão estatal nas primeiras horas de hoje. Ele tinha 82 anos.

Nascido em 1934, Rafsanjani estudou teologia em . Ele foi um dos líderes da Revolução Islâmica de 1979 que teve no lugar em Irão, que derrubou o Xá para fazer o país em uma república religiosa. Ele foi o primeiro a ocupar, durante nove anos, o discurso do Parlamento iraniano (Majlis) pós-revolução. Rafsanjani foi também nomeado representante superior do líder supremo aiatolá Ruhollah Khomeini no Conselho de Defesa Supremo, efectivamente comandante-em-chefe das Forças Armadas do Irã em 1988 para o fim da guerra Irã(o)-Iraque.

Um ano após o fim da guerra Irã(o)-Iraque, Rafsanjani se tornou presidente e levou o país na reforma pós-guerra, através da realização de uma política de liberalização econômica, fortalecimento e melhoria nas relações com nações vizinhas, incluindo árabes, Ocidente e a Ásia Central recém independente da extinta . Rafsanjani foi eleito para um segundo mandato e serviu como presidente até 1997.

Em 2005, Rafsanjani participou na eleição presidencial, mas perdeu para Mahmoud Ahmadinejad. Desde então, se tornou um de seus principais críticos. Rafsanjani se juntou com os reformistas em 2009, quando o presidente opositor Ahmadinejad foi reeleito em meio às acusações de fraude e violência política. O Conselho dos Guardiões bloqueou sua candidatura à presidência em 2013, alegando sua idade. Rafsanjani mais tarde apoiou o moderado Hassan Rouhani, que ganhou a eleição 2013. Rouhani é candidato à reeleição em maio deste ano.

Com a sua morte, o campo moderado e reformista perde uma influência partidária no seio da elite política iraniana. O enterro de Rafsanjani está programado para terça-feira (10/1).