Iran's supreme leader, Ali Khamenei, warned today that continuing divisions would lead to the collapse of the country's ruling elite, after a former president called for a referendum on the government's legitimacy.

The referendum call from Mohammad Khatami appeared to be part of an opposition strategy to keep Khamenei and allied hardliners on the defensive over last month's disputed elections.

It coincided with a demand from Mir Hossein Mousavi, the leading opposition candidate in those elections, for the release of opposition supporters detained for protesting against the official results, which gave a landslide victory to President Mahmoud Ahmadinejad.

Another former president, Hashemi Rafsanjani, gave a speech at Friday prayers in which he said the Islamic Republic was in crisis and the government had lost the trust of millions of Iranians.

Khamenei, whose previously unquestioned authority is now under daily challenge, hit back furiously. "The elite should be watchful, since they have been faced with a big test. Failing the test will cause their collapse," the supreme leader said, in a speech to mark a religious holiday, attended by government officials including Ahmadinejad, who sat on the stage behind him.

Khatami's call for a referendum represented a new tactic by the opposition, in its efforts to maintain the momentum of a protest movement harshly suppressed on the streets by pro-government militias.

"I state openly that reliance upon the people's vote and the staging of a legal referendum is the only way for the system to emerge from the current crisis," said Khatami, a reformist cleric who was president from 1997 to 2005. "People must be asked whether they are happy with the situation that has taken shape."

In remarks quoted on reformist Iranian websites, he suggested a referendum be overseen by an "impartial" body, such as the Expediency Discernment Council, which is chaired by Rafsanjani and is supposed to mediate disputes between clerical and lay organs of state.

Khatami's political organisation, the Association of Combatant Clerics, issued a statement on its website saying that a referendum should not be overseen by "bodies and centres that manipulated" the 12 June vote, a reference to the Guardian Council, a body that oversees elections and endorsed the official election result.

It is highly unlikely that either Khamenei or the Guardian Council would agree to such a referendum. It appeared to designed principally to open a new avenue of attack on the conservative establishment.

Mousavi also raised his own rallying cry to supporters at a meeting with the families of post-election detainees.

"You are facing something new: an awakened nation, a nation that has been born again and is here to defend its achievements," the former prime minister said. "Arrests ... won't put an end to this problem. End this game as soon as possible and return to the nation its [arrested] sons."Mousavi ridiculed the accusation repeatedly made by Khamenei and his allies that the protests were the product of foreign orchestration.

"Who believes that [the protesters] would conspire with foreigners and sell the interests of their own country? Has our country become so mean and degraded that you attribute the huge protest movement of the nation to foreigners? Isn't this an insult to our nation?" Mousavi said.

Amid the uncompromising rhetoric on both sides, the government appeared to make a small concessionary gesture, allowing detainees to call their families from prison for the first time.