Outside, police and pro-government Basiji militiamen fired tear gas and charges thousands of protesters who chanted "death to the dictator" and called on President Mahmoud Ahmadinejad to resign. Dozens were arrested, piled in trucks and taken away, witnesses said.
Plainclothes Basijis stood in front of a line of riot police and pumped canisters of tear gas, which young protesters with green bandanas over their faces kicked away across the pavement, away from the crowds. Some set a bonfire in the street and waved their hands in the air in victory signs.
The opposition aimed to turn the Friday prayers at Tehran University into a show of their continued strength despite heavy government suppression since the disputed June 12 presidential election.
Opposition leader Mir Hossein Mousavi, who claims to have won the election, sat in the front row of worshippers, attending for the first time since the turmoil began. Many of the tens of thousands at the prayers wore headbands or wristbands in his campaign color green, or had green prayer rugs.
In his sermon broadcast live on radio nationwide, Rafsanjani reprimanded the clerical leadership for not listening to people's complaints over the election, which was declared a victory for Ahmadinejad despite opposition claims of fraud.
"Doubt has been created (about the election results)," Rafsanjani said. "There is a large portion of the wise people who say they have doubts. We need to take action to remove this doubt."
Rafsanjani couched his sermon in calls for unity in support of Iran's Islamic Republic. But his sermon was an unmistakable challenge to Supreme Leader Ayatollah Ali Khamenei, who declared Ahmadinejad's victory valid and ordered an end to questioning of the results. Rafsanjani said the dispute has split clerics and warned of "crisis."
Worshippers interrupted Rafsanjani with chants of "azadi, azadi" -- Persian for "freedom" -- and the cleric got tears in his eyes as he spoke of how Islam's Prophet Muhammad "respected the rights" of his people. Rafsanjani said the leader of the 1979 Islamic revolution, Ayatollah Ruhollah Khomeini, "knew that people's vote was the most important thing in our country" and insisted it be enshrined in the founding of the Islamic Republic.
"Where people are not present or their vote is not considered, that government is not Islamic," Rafsanjani said.
He criticized the postelection wave of arrests, saying the leadership should show sympathy for protesters and release those detained. "Sympathy must be offered to those who suffered from the events... and reconcile them with the ruling system," he said. "We need to placate them."
Rafsanjani, a former president, regularly gives the Friday sermon but had not appeared since the election turmoil began. He is bitter rival of Ahmadinejad and is considered Mousavi's top supporter within Iran's clerical leadership, heading two of the three main clerical bodies that oversee the government. His daughter and four other relatives who openly backed Mousavi were briefly detained during protests last month.
In the days after the June election, hundreds of thousands marched in the streets in support of Mousavi. But after Khamenei validated the results, police, elite Republican Guards and Basiji militiamen launched a fierce crackdown on protesters in which hundreds were arrested and at least 20 killed -- though human rights groups say the figure could be several times that official toll.
The scene outside the university on Friday was tumultuous. Before the sermon, police fired tear gas at hundreds of Mousavi backers trying to enter. When Mahdi Karroubi, another pro-reform candidate in the June election, headed for the prayers, plainclothes Basijis attacked him, shoving him and knocking his turban to the ground, witnesses said. "Death to the opponent of Velayat-e-Faqih," they chanted as they attacked him, referring to the supreme leader, the witnesses said.
Also arrested was a prominent women's rights activist, Shadi Sadr, who was beaten by militiamen, pushed into a car and driven away to an unknown location, Mousavi's Web site www.mowjcamp.com and a women's rights site www.meydaan.com said.
Inside the prayers -- held on a former soccer field covered with a roof -- some worshippers rubbed their eyes as tear gas from outside drifted in. They traded competing chants with some hard-liners in the congregation. When the hard-liners chanted "death to America," Mousavi supporters countered with "death to Russia" and "death to China."
It was a reference to Ahmadinejad's alliance with both countries. Ahmadinejad has come under criticism in Iran for not criticizing Beijing over Muslim deaths in China's western Xinjiang province.
After the prayers, some worshippers joined the protests outside, swelling their numbers to thousands, witnesses said, speaking on condition of anonymity because of fears of government retaliation.
In his sermon, Rafsanjani -- known as a mercurial and savvy political insider -- was careful not to mention Khamenei. But he sharply criticized the Guardians Council, a powerful clerical body that has become Khamenei and Ahmadinejad's strongest backers. The Guardians Council oversaw the election, then conducted a partial recount that validated Ahmadinejad's victory. Opponents dismiss the recount.
Rafsanjani said the Guardians Council had had an "opportunity to unite the people and regain their trust," but the chance was "not used properly."
Rafsanjani heads two other top clerical bodies, the Experts Council and the Expediency Council. In the past week, a behind-the-scenes power struggle between Rafsanjani and the Guardians Council has become public, fueling heavy hard-liner criticism of Rafsanjani.
Rafsanjani also openly spoke of the split among clerics over the election. Many other prominent clerics have been sharply critical of the government or have failed to announce their backing for Ahmadinejad, including most of the country's "maraje'-e-taghlid," or "sources of emulation," Shiite clerics of the highest rank whose religious rulings are closely obeyed by their many followers.
"The maraje'-e-taghlid have always supported and served (the people). Why some of them are offended?" Rafsanjani said. "We need to keep them beside us. We need to support them and rely on them."