Some clerics have come out strongly in favour of the protesters and reformists
By Roger Hardy
BBC Middle East analyst
The focus of the Iran crisis has shifted from the street to the seminary.
Clerics are having to choose whether to align themselves with the conservatives or the reformists - or maintain an awkward silence.
More than three weeks after the elections of 12 June, a troika of senior reformists form the core of the opposition to an outcome they regard as fraudulent.
These are the two main defeated candidates, Mir Hossein Mousavi and Mehdi Karoubi, and their close ally, the former President Mohammed Khatami.
Hard-liners are calling for all three to be put on trial.
A few senior clerical figures - including Ayatollahs Montazeri and Sanei - have aligned themselves with the reformist camp.
On Saturday a group of reformist clerics in the holy city of Qom issued a strong statement questioning the legitimacy of the election.
They even criticised the Council of Guardians, the influential clerical body which had declared the elections free and fair. Its members, said the clerics, "had disproved their impartiality months ahead of the election".
Mullahs in the middle
But there are not just two camps: there is an important middle ground which both sides are anxious to influence.
Many clerics are sitting nervously on the fence.
Some actively dislike the officially announced winner of the elections, Mahmoud Ahmadinejad, considering him a reckless populist who has mismanaged the economy and made Iran a laughing-stock abroad.
The powerful former President Rafsanjani looks to be facing both ways
Others are appalled at the way protest has been suppressed, and worry that this has thoroughly discredited the Islamic Republic - and, by extension, the clerical establishment.
But they are under intense pressure to remain loyal to the man at the centre of the crisis - Ayatollah Ali Khamenei, who has been the Supreme Leader for the last 20 years.
Whatever they think of Mr Ahmadinejad, few want to show public disloyalty to the Supreme Leader.
Of all those who find themselves caught uncomfortably in the middle, the most important is former President Hashemi Rafsanjani.
He had backed the campaign of the main reformist candidate, Mir Hossein Mousavi, in an effort to deny Mr Ahmadinejad a second term.
He was furious when, during the campaign, the president publicly alleged that he and his family were corrupt.
He issued an open letter calling on the Supreme Leader to intervene, which the latter pointedly declined to do.
But now Mr Rafsanjani's position is more ambiguous.
At the weekend he met families of those who had been arrested - a sign of concern for the fate of the protesters.
But at the same time, there are hints that he is backing off from confrontation.
He has been part of the senior clerical establishment for too long to break with it now.
So he is facing both ways, positioning himself as a potential conciliator.
The crisis is not over.
If the rhetoric of the hard-liners is to be believed, further repression may be in store - directed particularly at the Mousavi camp, seen as the centre of resistance.
But even if the regime clings to power, it will do so with its credibility and cohesion seriously damaged.
Forced to choose between survival and legitimacy, it has chosen survival.