Former president Akbar Hashemi Rafsanjani's pragmatic policies attracted fierce supporters and critics, but his funeral in Tehran brought both sides together.
Hundreds of thousands of Iranians have massed in central Tehran for the funeral of former president Akbar Hashemi Rafsanjani in a show of unity to honour the Islamic Republic's polarising pragmatist.
Rafsanjani, who died on Sunday aged 82, was buried next to Ayatollah Ruhollah Khomeini, who led the country's Islamic revolution in 1979 and founded the country's system of theocratic rule.
Rafsanjani's pragmatic policies of economic liberalisation and better relations with the West attracted fierce supporters and equally fierce critics during his life, but his funeral brought both sides together in a show of solidarity and unity.
Popularly known as a "pillar of the Revolution", he wielded wide influence in core decision-making bodies of Iran.
In a move seen at the time as power-sharing, he played a significant role in 1989 to appoint Ayatollah Ali Khamenei to succeed Khomeini as new supreme leader of Iran.
Rafsanjani was elected as new president a few months later.
However, their friendship gradually turned into rivalry as the pragmatist president sided with reformists who promoted freedoms, while Khamenei followed a conservative interpretation of the core values of the Islamic Republic.
In his condolence message, Khamenei said political differences could never "entirely break up" his nearly 60 years of friendship with Rafsanjani.
Streets were filled overnight with billboards that showed a picture of the two men smiling and chatting as close friends.
"No one would be like Hashemi for me," the billboards quoted Khamenei as saying, using Rafsanjani's first family name. Iranians usually have two family names.
"Ayatollah Hashemi tried all his life to save the Islamic Revolution ... He wanted to preserve the unity of Iran," his son Mohsen was quoted as saying by state news agency IRNA at the funeral.
Rafsanjani's death ahead of May's presidential election was a blow to moderate president Hassan Rouhani, who allied himself with him to win the 2013 election and went on to resolve Iran's long standoff with the West over its nuclear program.
Rafsanjani was a member of the Assembly of Experts, the clerical body that selects the supreme leader, Iran's most powerful figure. His absence from that debate, whenever it happens, means the chances of a pragmatist emerging as the next supreme leader are reduced.