As night settled in, the streets in northern Tehran that recently had been the scene of pre-election euphoria were lit by the flames of trash fires and blocked by tipped trash bins and at least one charred bus. Young men ran through the streets throwing paving stones at shop windows, and the police pursued them.

Earlier in the day, hurried meetings were reported among Iran’s leading political figures and clerics; some were said to be trying to influence Ayatollah Khamenei to intervene in a situation that could stain public confidence in the integrity of Iran’s elections.

But Saeed Leylaz, an economist and political analyst, said he believed that Ayatollah Khamenei’s statement would bring a resolution, even if demonstrations persisted for a few days. “This has put an end to political negotiations from above,” Mr. Leylaz said.

For the moment, Ayatollah Khamenei’s admonition did nothing to calm the opposition’s rage.

“The results of the 10th presidential election are so ridiculous and so unbelievable that one cannot write or talk about it in a statement,” said Mehdi Karroubi, a reformist cleric and candidate.

Mr. Karroubi came in last with 300,000 votes  far fewer than analysts had predicted. “It is amazing that the people’s vote has turned into an instrument for the government to stabilize itself,” he said.

The other candidate, Mohsen Rezai, got 680,000 votes, Interior Ministry officials said.

In 2005, when Mr. Karroubi was also a candidate for president, he accused the government of rigging the vote in Mr. Ahmadinejad’s favor. In that election, the government announced when polls closed that there would probably be a runoff between two of three candidates, a reform candidate and a former police chief.