DUBAI (Reuters) - Hundreds of thousands of Iranians massed in central Tehran on Tuesday for the funeral of former president Akbar Hashemi Rafsanjani, an influential figurehead of the Islamic Republic whose pragmatism led to a rift with Iran's supreme leader.
Rafsanjani, who died on Sunday aged 82, was buried next to Ayatollah Ruhollah Khomeini, the leader of Iran's Islamic Revolution in 1979 who founded its system of theocratic rule.
Rafsanjani's policies of economic liberalisation and better relations with the West attracted fierce supporters and equally fierce critics during his life.
While many of his opponents turned out to honour him, and Supreme Leader Ayatollah Ali Khamenei stressed their close bond, what was intended by the state as a show of unity was clouded by the chants of thousands opposition supporters, as well as the absence of reformist ex-president Mohammad Khatami.
An eyewitness told Reuters on the phone from Tehran: "Some were chanting slogans asking for political prisoners to be released, some hardliners were shouting 'Death to America!'. But they didn't clash. Everyone was respectful."
Some of the chants called for the release of former prime minister Mir Hossein Mousavi and of Mehdi Karoubi, a cleric and former speaker of parliament who lost the disputed 2009 presidential election to incumbent Mahmoud Ahmadinejad.
Both men refused to accept the results of that election and were placed under house arrest while Rafsanjani, who had backed them, was politically isolated along with his family.
Two separate sources said Hashemi's daughter Faezeh, jailed for six months in 2012 on charges of anti-government propaganda, had told people at the funeral that Khatami had been banned from attending. On state television's live coverage, the opposition chants were drowned out by solemn music.
As a leading power-broker, Rafsanjani helped Khamenei to secure Iran's most powerful position, that of supreme leader, after Khomeini's death in 1989, and won election as president himself a few months later.
However, their friendship gradually turned into rivalry as Rafsanjani, who continued to wield enormous influence even after his eight years as president ended, sided with reformists who promoted greater freedom, while Khamenei interpreted the values of the Islamic Republic much more conservatively.
In his condolence message, Khamenei said political differences had never been able to "entirely break up" their nearly 60 years of friendship.
Streets were filled overnight with billboards that showed a picture of the two men smiling and chatting as close friends.
"No one will be like Hashemi for me," the billboards quoted Khamenei as saying, using Rafsanjani's first family name.
It was Khamenei who said the final prayer over Rafsanjani's body in the University of Tehran courtyard where the late president delivered many of his sermons during Friday prayers.
Politicians, military commanders and religious figures from all camps stood behind him.
President Hassan Rouhani, the head of parliament, the head of the judiciary and senior Khamenei advisers stood in the first line at the service, while cabinet ministers and the deceased leader's relatives filled the rows behind them.
Rafsanjani's body, sealed in a metal coffin with his white turban on top, was then brought in procession down Revolution Street in central Tehran, where hundreds of thousands of people came out in cold winter weather to pay tribute.
Among those attending were Revolutionary Guards Commander Qassem Soleimani, leading Iranian Sunni cleric Molavi Abdolhamid Ismaeelzahi, several of Khomeini's grandsons and even a number of Iranian movie stars.
Rafsanjani's death is a blow to Rouhani, whom he had backed in the 2013 presidential election and who now faces re-election having resolved Iran's long nuclear standoff with the West but shown little of the economic payoff that he had promised.
Rouhani's deputy chief of staff, Hamid Aboutalebi, tweeted: "The glorious presence of people of Tehran in the funeral and their tearful farewell show that they will never forget Rafsanjani’s moderate thoughts and his allies."
Rafsanjani was a member of the Assembly of Experts, the clerical body that selects the supreme leader. His absence from that debate, whenever it happens, means the chances of a pragmatist succeeding Khamenei are reduced.
Reporting by Bozorgmehr Sharafedin; Editing by Kevin Liffey