Three of them were later released, but the case of one of the Russians and that of a detained Afghan national had been handed over to the judiciary, prosecutor Abbas Jafari Dolatabadi told the ISNA news agency. He did not give any names.

Iran has accused its Western enemies of stoking street unrest that erupted after the Islamic Republic's disputed election in June, which plunged the country into its deepest internal crisis since the revolution three decades ago.

Jafari Dolatabadi said the five were detained during the rallies, without making clear if they were all held in Tehran.

"(The case of) one Afghan was handed over to the judiciary because of taking part in an illegal gathering (in western Tehran) ... on the sideline of the main rallies," he said, apparently referring to an opposition rally.

"A Russian national, who was arrested for illegally entering the country, was handed over to the judiciary and the Revolutionary Court is studying the case," the prosecutor added.

On Thursday, Iranian state television said "tens of millions of people" rallied to support the revolution across the country of 70 million. An opposition website said security forces fired teargas at opposition supporters staging a Tehran counter-rally.

Russia is among six world powers involved in efforts to find a diplomatic solution to a long-running international dispute over Iran's nuclear program, which the West suspects is aimed at making bombs. Tehran denies the charge.

The Kremlin said on Tuesday Iran could face sanctions if it failed to allay international fears over its nuclear program.

A French teaching assistant, Clotilde Reiss, was arrested in Tehran after the election on accusations of taking part in a Western plot to destabilize the Iranian government. She has been out of jail on bail and is staying at Embassy of France, which is also one of the six world powers.