Hundreds of thousands of mourners attended the funeral on Tuesday of ex-president Akbar Hashemi Rafsanjani, whose death leaves a hole in the upper reaches of power for Iran's moderates.
Supreme leader Ayatollah Ali Khamenei led the eulogies to the former president at Tehran University despite their "differences".
President Hassan Rouhani, who spearheaded the thaw with the West that culminated in a 2015 nuclear deal, was also present,
But so were his conservative rivals, parliament speaker Ali Larijani, and his brother and judiciary chief Ayatollah Sadegh Larijani.
Former president Mohammad Khatami, an ally of Rafsanjani but long out of favour with the regime, was not part of the official delegation at the funeral ceremony.
Some Twitter users said he had been prevented from attending.
At the south Tehran mausoleum of Ayatollah Ruhollah Khomeini, leader of Iran's 1979 Islamic revolution, where Rafsanjani was to be laid to rest, tens of thousands awaited the arrival of his body.
The truck carrying Rafsanjani's coffin topped with his trademark white turban inched down Enghelab Avenue, one of the capital's main thoroughfares.
The pressure of the crowd broke a traffic barrier, the Shargh newspaper reported on Twitter.
Rafsanjani, who served as president from 1989 to 1997, was a father figure for Iran's moderate and reformist camps.
He fell out of the regime's highest inner circle after the 2009 re-election of hardline former president Mahmoud Ahmadinejad, when he spoke out against the use of lethal force on protesters who claimed the vote was rigged.
- 'Hail Khatami' -
State television coverage of the funeral procession captured a few seconds of chants of "Hail Hashemi (Rafsanjani), hail Khatami," before the broadcaster drowned it out with solemn music.
Video clips published on social media showed pockets of mourners in the streets around the funeral venue chanting slogans in support of both Khatami and fellow reformist Mir Hossein Mousavi.
Mousavi and Mehdi Karoubi, two of the losing candidates in the 2009 election, have been under house arrest since 2011 for leading the so-called Green Movement protests that the regime calls "sedition".
Khatami is under a strict media ban and is often prevented from attending public events.
Rafsanjani's son Mohsen invited people to attend the service "in full tranquility".
"Ayatollah Rafsanjani's concern was unity... and we should show off our unity to the world," he said on Monday.
Black banners were raised in Tehran and some posters showed the supreme leader and Rafsanjani together smiling. Another poster said "good bye, old combatant".
Free bus or metro travel was provided to the funeral venue.
Since Rafsanjani's death, messages of condolence have poured in both from at home and and abroad.
Even the White House sent a message, unprecedented since the 1979 revolution that led to cutting of ties between Tehran and Washington.
"Former president Rafsanjani was a prominent figure throughout the history of the Islamic Republic of Iran and the United States sends our condolences to his family and loved ones," spokesman Josh Ernest said.
"He was a consequential figure inside Iran. But you know, for what potential impact this could have on Iranian policy, I wouldn't speculate."
One of Iran's most controversial figures in the West, the head of its Revolutionary Guards' foreign operations division, Major General Qassem Suleimani, was seen at the funeral.
Rafsanjani's death is a blow to Rouhani as he prepares to seek a second term in May.
The incumbent president has come under mounting criticism from conservatives and hardliners over the so far disappointing economic dividends from the lifting of international sanctions under the 2015 nuclear deal.