Obituary: Akbar Hashemi Rafsanjani
Akbar Hashemi Rafsanjani was a founding father of the Iranian revolution who went on to serve as the country's president between 1989 and 1997 and remained a powerful figure until his death on 8 January 2016, at the age of 82.
Seen as "pragmatic conservative", Rafsanjani was a leading member of the Iran's religious establishment who gained popularity in later life among the country's moderates. He boasted of a long-standing relationship with Supreme Leader Ayatollah Khamenei, while also calling publicly for greater freedoms for Iranians.
Rafsanjani was also one of Iran's richest men, and he maintained close links to Iranian industry and business throughout his life. In 2003 he was featured in the Millionaire Mullahs section of the Forbes Rich List.
He was dogged by accusations that he abused his political connections to amass a large personal fortune - allegations that he always denied. His wealth and leadership style earned him a nickname among Iranians - "Akbar Shah", or "Great King".
By 2002, he had fallen out of favour with conservative clerics, military commanders, and public, and he lost his seat in parliament. But the same year he was elected head of the Expediency Council, a powerful body that adjudicates disputes over legislation, and held the post until his death.
He ran again for the presidency in 2005 but lost to Mahmoud Ahmadinejad. In 2013 he attempted to run again, registering for the ballot with just minutes to go, but he was barred from standing by Iran's electoral watchdog.
He went on to be openly critical of Mr Ahmadinejad and became a key supporter of his reform-minded successor, Hassan Rouhani.
Born in 1934 in south-eastern Iran to a family of farmers, Rafsanjani studied theology in the holy city of Qom with Ayatollah Khomeini, whose close follower he became. He was imprisoned several times under the Shah.
He was speaker in the Majlis (Iran's parliament) from 1980 to 1989. 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 which ended the war.
As president, Rafsanjani sought to encourage a rapprochement with the West and re-establish Iran as a regional power.
His influence in Lebanon helped to bring about the release of Western hostages there in the early 1990s.
Domestically, Rafsanjani pursued an economically liberal policy which critics said failed to deliver on social justice. He also opposed harsh Islamic penal codes and promoted better job prospects for women.
His financial policies aimed to move Iran from the state-controlled economy of the Iran-Iraq war years to a more market-based system.
Under Mr Ahmadinejad's presidency, from 2005 to 2013, he was a fierce critic of economic policies which he said seriously damaged Iran.
On the nuclear issue, he was in favour of negotiation with the West but warned his countrymen against "accepting bullying and imposition". Indeed, he warned Washington that its "threats" were futile.
In 2007, at Friday prayers, he spoke out against nuclear weapons and said he was disappointed that the US, which still has a nuclear arsenal, was trying to stop Iran from using nuclear energy for peaceful purposes.
In 2002, Mr Rafsanjani was appointed head of the powerful Expediency Council, which arbitrates in disputes between the Majlis and the Guardian Council which can block legislation.
In 2006, he was elected to the Assembly of Experts and a year later was voted leader of the body which appoints the supreme leader.
Hardliners within the Assembly of Experts were strongly opposed to Mr Rafsanjani's bid to remain as leader in elections in January 2009. He stood against Ayatollah Mohammad Taghi Mesbah Yazdi, a supporter of President Ahmadinejad, and won a convincing majority.
In the 2009 presidential election, he backed the reformist Mir-Hossein Mousavi, who stood against President Ahmadinejad but was defeated.
Clash with Khamenei
Following that election supreme leader Ayatollah Ali Khamenei distanced himself from Mr Rafsanjani and took away his title of Tehran's Friday prayer leader.
Rafsanjani also lost his position as the head of the Assembly of Experts. His son Mehdi and daughter Faezeh were temporarily imprisoned on what many saw as trumped-up charges to put pressure on their father.
He was attacked by the conservative and right-wing press for suggesting that he might register for the elections.
But among the country's moderates Mr Rafsanjani was seen as a master manipulator who had a foot in the door of the establishment and a hand in the affairs of the opposition, and who could, theoretically, create a more open and predicable political climate.
Unable to stand in 2013, Rafsanjani supported moderate candidate Hassan Rouhani and Mr Rouhani's win gave the former president an insider role in reform efforts, including the new president's push for nuclear talks with the US.
His sudden death will be seen as a major blow to Mr Rouhani, who is preparing himself for re-election in May. Mr Rouhani was the first top official to attend the hospital where Mr Rafsanjani died. Reports say Mr Rouhani was in tears, and a crowd gathered outside the hospital after the announcement.
Rafsanjani is survived by his wife, Effat Marashi, their sons Mohsen, Mehdi and Yasser, and daughters Fatemeh and Faezeh. Faezeh is a prominent women's rights activist and former MP.