BEIRUT, Lebanon  As thousands of protesters chanted Friday in the streets outside, a former Iranian president, Ali Akbar Hashemi Rafsanjani, assailed the government’s handling of the post-election unrest, saying it had lost the trust of many Iranians, and called for the release of hundreds of those arrested in recent weeks.

Mr. Rafsanjani, speaking to a vast crowd at Tehran University’s prayer hall, advanced the cause of Iran’s beleaguered opposition, saying doubts about the disputed June 12 election “are now consuming us” and calling for a new spirit of compromise from the government.

“A large group” of Iranians, he said, have doubts about the election. “We should work to address these doubts,” he said.

His appearance emboldened opposition supporters, who asserted themselves more aggressively than they had in weeks. Tens of thousands of people converged around the prayer hall, witnesses said. Police officers beat back large crowds of chanting protesters with tear gas and truncheons. There were reports of at least 15 arrests.