One of Iran's most prominent dissident clerics, Grand Ayatollah Hoseyn Ali Montazeri, has died aged 87.
Hoseyn Ali Montazeri was a moving spirit in the 1979 revolution which created Iran's Islamic state, and was at one stage set to become its leader.
One of Shia Islam's most respected figures, he was also a leading critic of President Mahmoud Ahmadinejad.
The BBC's Jon Leyne says the death comes at a crucial time in a standoff between the government and opposition.
Iran's rulers will now fear the opposition may attempt a big turnout for his funeral on Monday and other ceremonies marking his death, especially in the run-up to the Shia Muslim festival of Ashura on 27 December, our correspondent says.
Mourners gather
Large crowds have gathered outside Montazeri's home in the holy city of Qom, following his death on Saturday evening.
He will be laid to rest at the shrine of Hazrate Masoumeh, one of the most revered female saints in Shia Islam, his office told AFP news agency.
Thousands of people from Isfahan, Najafabad, Shiraz and other cities are on their way to Qom to attend Monday's ceremony, according to one report.
The cleric's son told the BBC that his father had died of natural causes.
He was quoted by Ilna news agency as offering "condolences to... all people who seek freedom and justice, to those who fight in the path of God all over the world," reports AFP.
Illness
Montazeri's doctor told state television the cleric was a diabetic who also had lung problems and asthma.
"In fact he was suffering from several diseases," he said.
A thorn in the establishment's side, Montazeri issued a fatwa condemning President Ahmadinejad's government after June's disputed election.
But that was not his first clash with authority - he repeatedly accused the country's rulers of imposing dictatorship in the name of Islam and said the liberation that was supposed to have followed the 1979 revolution never happened.
During his lifetime, the cleric was transformed from a pillar of the Islamic revolution to one of the most vocal critics of its leadership.
He had been designated to succeed the Islamic Republic's founder, Ayatollah Ruhollah Khomeini, but the pair fell out over Iran's human rights record a few months before Khomeini died of cancer in 1989.
In 1997 he famously clashed with Khomeini's successor, Ayatollah Ali Khamenei, whom he outranked in the religious hierarchy, after questioning the powers of the Supreme Leader.
This led to the closure of Montazeri's religious school and an attack on his office in Qom. He was placed under house arrest for six years.
After his detention, state-run media began referring to him as a "simple-minded" cleric, references to him in schoolbooks were erased and streets named after him were renamed, but he remained defiant.
Born into a provincial family and educated at a seminary, Hoseyn Ali Montazeri came to prominence as one of the early backers of Khomeini.
Tortured
Prior to the overthrow of the Iranian monarchy, he organised public protests in support of Khomeini, following the latter's arrest.
As a result he was repeatedly detained himself and tortured in jail.
While Khomeini was in exile in Iraq, Montazeri was nominated as his representative in Iran, and after the revolution, he was designated as successor.
But he was marginalised after questioning decisions taken by the Supreme Leader and calling for a transparent assessment of the revolution's failures.
In his opposition to President Ahmadinejad, he became an unlikely inspiration for Iranian reformists.
Despite his old age and failing health, Hoseyn Ali Montazeri backed the opposition's claims that the 2009 election result, which gave President Ahmadinejad a landslide victory, had been widely rigged.
The cleric had often said his opinions were guided by his "sense of religious duty".
What are your memories of Grand Ayatollah Hoseyn Ali Montazeri?
Send your comments using the post form below.
A selection of your comments may be published, displaying your name and location unless you state otherwise in the box below.