TEHRAN, Iran - A pivotal presidential election in Iran ended in confusion and confrontation early this morning as both sides claimed victory and plainclothes officers fired tear gas to disperse a cheering crowd outside the campaign headquarters of opposition candidate Mir Hossein Mousavi.

With votes still being counted in many cities, incumbent President Mahmoud Ahmadinejad was leading by a 2-1 ratio in the early returns, according to Iranian Interior Ministry officials. Mousavi's supporters dismissed those numbers, saying the ministry was effectively under Ahmadinejad's control.

"I am the winner of these elections," Mousavi declared late last night, after heavy turnout - 75 percent, by one estimate - resulted in a two-hour extension of voting across the Islamic republic. "The people have voted for me."

When Mousavi's youthful supporters gathered after midnight outside his Tehran headquarters to celebrate his claim to victory, officers quickly dispersed them with tear gas, said Milad Afsarzadeh, a Mousavi campaign official inside the building.

He and other witnesses to the brief melee said it was unclear whether the officers were police or members of the Baseej, a paramilitary force of volunteers organized by the Revolutionary Guards and greatly feared by student demonstrators.

The witnesses said it was also unclear whether the plainclothes officers were taking sides in the election or enforcing rules against street demonstrations to try to prevent clashes between impassioned backers of Mousavi and Ahmadinejad.

The election has stirred deep passions among Iran's 46 million eligible voters, pitting Ahmadinejad, a populist who promised to help the poor and to make Iran a world power, against three challengers. If none wins a clear majority, the election will go to a runoff between the two top vote-getters next week.

Although final say over Iran's foreign and domestic policies rests with its unelected supreme leader, Ayatollah Ali Khamenei, Mousavi portrayed himself as the candidate for change, pledging to take a less confrontational tone in relations with the West and to provide more technocratic management of the economy.

His campaign produced an outpouring of enthusiasm from youth, intellectuals, and an older generation of Iranian leaders, while Ahmadinejad drew his core support from rural and working-class voters, plus elements of the military and conservative Islamic clergy.

Ahmadinejad, who has been president since 2005, did not make any immediate statement after the polls closed, but his supporters pointed to the Interior Ministry's tally to claim victory.

By early today, Ahmadinejad had 65.2 percent and Mousavi had 31.8 percent with 77 percent of all votes counted, said Kamran Daneshjoo, a senior official with the Interior Ministry, which oversees the voting.

Based on figures from the ministry, about 75 percent of eligible voters went to the polls.

Mousavi's supporters said that officials were trying to steal the election and cut off alternative sources of information. For several hours during the balloting yesterday, they said, international phone lines to Tehran were down and text messaging - which Mousavi's supporters had used to organize street rallies - was blocked. Members of the Baseej reportedly seized a building in North Tehran that housed several Web sites supporting Mousavi, which were shut down.

A senior aide to another opposition candidate, Mehdi Karroubi, alleged that the Interior Ministry was distorting the early vote count by providing results from the countryside and not Iran's cities. "We believe these results are void and not acceptable," said the aide, Morteza Alviri.

Mousavi, meanwhile, issued a written statement thanking the "dear people of Iran" for his victory.

"I would like to inform you that in spite of wide-ranging fraud and problem-making, according to the documents and reports we have received, the majority of your votes have been cast in favor of your servant," the statement said.

It concluded with a veiled suggestion of a possible confrontation, calling his supporters to go into the streets to celebrate his victory tonight and warning that if the votes were not fairly counted, "I will use all legal facilities and methods to restore the rights of the Iranian people."

The Interior Ministry, which is in charge of conducting the election and counting the votes, is headed by Sadegh Mahsouli, a staunch supporter of Ahmadinejad. But its results must be confirmed by the Guardian Council, a panel of senior Islamic clergymen led by Khamenei, the supreme leader. Both Khamenei and Mousavi, who was prime minister from 1981 to 1989, are members of an older generation of Iranian revolutionaries who overthrew the shah 30 years ago.

Mousavi's written statement and late-night news conference claiming victory capped a day of long lines at polling places across the capital.

"We haven't voted in 10 years' time," said Giti Ghioshfar, who was waiting with her husband to vote for Mousavi near Tehran's Fatemi Square. "We are here because we want more freedom," she said.

In Shahr-e Rey, south of Tehran, voter Ali Badiri said that young women without head scarves had been dancing in the streets over Mousavi's candidacy. "I'll vote for Ahmadinejad, because if Mousavi wins, they will be dancing naked next week," he said.

"We don't want to change Iran," said Abdollah Khalili, another Ahmadinejad voter. "We want this system to remain the way it is."

This article contains information from the Associated Press.