The price has been high of massive and sometimes violent Iranian reaction to the official landslide reelection of President Mahmoud Ahmadinejad. But no one has paid more than the country's supreme religious leader Ayatollah Sayed Ali Khamenei, whose decision to bless the result as "divine" – and side openly with Mr. Ahmadinejad, despite charges of extensive fraud – has sparked the widest popular challenge to the Islamic Republic in 30 years.

Experts suggest a number of reasons, from his ties to the military and security forces, to populist domestic and hardline foreign policies, to sheer loyalty, that might have caused the leader to approve of – or even engineer – an Ahmadinejad win.

"[Ayatollah Khamenei] realizes that the armed forces of the establishment are more supportive of Ahmadinejad than they would be of anyone else," says Massoumeh Torfeh, an Iran specialist at the School of Oriental and African Studies in London.

On Monday, police and armed basiji militants, operating from their makeshift base at the large Shirudi sports complex in downtown Tehran, forcefully prevented several hundred people from gathering at the nearby Haft-e Tir Square.

The Revolutionary Guard threatened a "revolutionary confrontation" to put down any further protests.

Analysts say that, among other things, Ahmadinejad's four-year cultivation of the basiji and Revolutionary Guard forces with posts and contracts may have given him an edge.

"Ahmadinejad came from them. Ahmadinejad always had their support, and Ahmadinejad placed them in all important positions of power, right across the country; governors and all the provincial places are full of Revolutionary Guards, basiji, and his people – he changed everyone," says Ms. Torfeh. "He's put them there. He's looked after them.... He's got the thugs. He's got the power behind him, and of course Khamenei has."

A political analyst, speaking in Tehran, says the supreme leader prefers Ahmadinejad's tough stance in foreign policy, which in four years has yielded a boost in Iran's nuclear program from zero to some 7,000 centrifuges enriching uranium – despite United Nations and Western sanctions. In addition, Washington is no longer talking about regime change, but asking for dialogue.

"This was Khamenei's hardball foreign policy, and it's worked," says the analyst, who asked not to be named. "If you care about your geopolitical position, what matters most? Not sanctions. You are standing tall, and you basically won against your [foreign] enemies."

"[Khamenei] never anticipated such a reaction [and] miscalculated everything," says another political analyst in Tehran, who could not be named for fear of reprisal. "I strongly believe that he is the one pulling the strings [and] this has been a project in the making over the last year or so."

Official decision: 'No major fraud'

The Guardian Council – the powerful 12-cleric body examining 646 electoral complaints – stated on Tuesday that "no major fraud" occurred in the election, and ruled out a rerun. Earlier it had found that 50 cities showed more than a 100 percent turnout, affecting some 7 percent of the entire vote.

The negative public reaction was predictable over such a large and unexpected Ahmadinejad victory, if not the scale of protest that has brought protesters onto the streets, to be stamped out violently by riot police and basiji militiamen with bullets, clubs, and knives.

The official death toll is 20, but sources in Tehran suggest one far higher. More than 450 have been detained, though unofficial figures suggest it could reach 1,500. Human rights groups describe agents arresting and taking away wounded protesters from hospitals.

Judicial official Ibrahim Raisi said on Tuesday a special court would be set up to try demonstrators: "Elements of riots must be dealt with to set an example. The judiciary will do that," he said, in remarks quoted by state radio, according to the Associated Press.

Khamenei left no room for compromise when he declared during a Friday sermon that Ahmadinejad was the clear victor, that the election was clean, and that street marches had to end.

Khamenei: Ahmadinejad's views closest to mine

For two decades as Iran's highest authority, Khamenei has largely kept above the political fray. But on Friday, he said Ahmadinejad's views were closest of all candidates to his own, and ruled out a rerun of the vote as demanded by supporters of defeated candidate Mir Hossein Mousavi.

During protests, demonstrators have burned banners showing the supreme leader and chanted "Death to Khamenei," according to video images uploaded onto the Internet.

Frustration seems to have grown in recent days, since big clashes on Saturday yielded to the much smaller street showing on Monday.

"When is it right to take up guns?" asked one angry Iranian contacted on Tuesday. "We are emphasizing silence and peaceful. Is it wrong [to] think about the violent way?"

"I think right now the aim is just to push them back and scare them enough to stop killing us," says this Iranian, who could not be further identified. "Then we will think of what we want for the country."

Lonely at the top

Though Khamenei has "crushed" key rivals, says the second analyst, his standing is less sure. He has "already lost the reformist camp, [and] many within the conservative camp are not happy with the way he handled the situation by bringing himself down to the level of Ahmadinejad."

"So he is lonely, though still supreme leader. But the supremacy comes from the gun rather than loyalty," adds the analyst. "The slim minority that loves him no matter what is still there, even though part of that constituency has become a little concerned."