Iran's interior ministry said Saturday President Mahmoud Ahmadinejad was far ahead with nearly 80 per cent of all votes counted, but his pro-reform rival countered that he was the clear victor and warned of possible fraud in the election.

The dispute rose up even before the votes were counted -- sharply boosting tensions after an intense month-long race between the combative president and his main challenger, Mir Hossein Mousavi, who has the backing of a growing youth-oriented movement.

Mousavi declared himself "definitely the winner" based on "all indications from all over Iran." He also alleged widespread irregularities, including closing polls with voters still waiting -- suggesting he was ready to challenge the results.

But bringing any showdown into the streets would certainly face a swift backlash from security forces, which have already issued stark warnings against unrest or any threat to the Islamic regime. A series of cyber-strikes -- text messaging blackouts, blocks on pro-Mousavi websites and widespread Internet disruptions -- also raised worried that authorities were prepared to exert further pressures on the communications lifelines of the rejuvenated reformist movement.

The messy and tense outcome capped a long day of voting. It was extended for several hours to accommodate a huge turnout that had people waiting for hours at polling stations in blistering heat and nighttime downpours.

Mousavi, a 1980s-era prime minister, had been counting on an outpouring from what's been called his "green tsunami" -- the signature colour of his campaign and the new banner for reformists seeking wider liberties at home and a gentler face for Iran abroad. He raised hopes that a new leadership might embrace U.S. President Barack Obama's invitation to open dialogue and take a less confrontation path with the West over Iran's nuclear program.

But moments after Mousavi called a news conference to declare victory, Iran's state news agency reported that Ahmadinejad was the victor. Both claims came shortly after polls close but before any vote tallies were announced.

Before dawn, Ahmadinejad supporters weaved through Tehran's streets on motorbikes shouting "Allahu Akbar," or God is Great.

Ahmadinejad leads

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

Based on figures released by the ministry, around 75 per cent of the 46.2 million eligible voters went to the polls.

There was no sign of increased security, but the warnings had already been issued.

The political chief of the powerful Revolutionary Guard cautioned Wednesday it would crush any "revolution" against the Islamic regime by Mousavi's "green movement." The interior ministry said all rallies or political gatherings would be banned until after the formal announcement of results later Saturday.

Mousavi, however, was equally harsh -- accusing the Islamic establishment was "manipulating the people's vote" to keep Ahmadinejad in power.

"I'll pursue this. I won't give us. There is no way back," he said.

During the voting, some communications across Iran were disrupted. Internet connections slowed dramatically in some spots, hindering the operations of news organizations including The Associated Press. It was not immediately clear what had caused the disruptions.

About a dozen Ahmadinejad supporters pelted a Mousavi office in Tehran with tear gas canisters, but no one was injured, said Saeed Shariati, head of Mousavi's web campaign. The attack could not be independently confirmed.

History of vote rigging allegations

Iran does not allow international election monitors. The ruling clerics, however, put their stamp on the elections from the very beginning by deciding who can run. More than 470 people sought to join the presidential race, but only Ahmadinejad and three rivals were cleared.

During the 2005 election, there were some allegations of vote rigging from losers, but the claims were never investigated.

The rush to the polls reflected the intensity of the campaign that riveted the world's attention for its wide-open passions and Western-style tactics, including a savvy Web campaign and all-night street parties by Mousavi's young backers.

Some waited for hours in temperatures that hit 113 degrees in Iran's central desert. In Tehran, a bride in her wedding gown cast her ballot. Families making traditional Friday visits to relatives' graves filed into polling stations in the capital's sprawling cemetery.

The outcome, however, will not sharply alter Iran's main policies or sway major decisions, such as possible talks with Washington. Those crucial issues rest with the ruling clerics headed by the unelected Supreme Leader Ayatollah Ali Khamenei.

But the election focused on what the office can influence: boosting Iran's sinking economy, pressing for greater media and political freedoms, and being Iran's main envoy to the world.

Only weeks ago, Ahmadinejad (Ah-mad-in-A-jad) seemed ready to coast to re-election with the reformist ranks in disarray. But Mousavi's bid began to gain traction with young voters with his web outreach and hip "green" rallies. Suddenly, the 67-year-old Mousavi became the surprise hero of a powerful youth-driven movement and heading into the vote, it looked like the momentum was with him.

In Washington, Obama said the "robust debate" during the campaign suggests a possibility of change in Iran, which is under intense international pressure over its nuclear program.

"Ultimately the election is for the Iranians to decide," said Obama. "But ... you're seeing people looking at new possibilities. And whoever ends up winning the election in Iran, the fact that there's been a robust debate hopefully will help advance our ability to engage them in new ways."

After casting her ballot at a mosque in central Tehran, 23-year-old Mahnaz Mottagh said: "I hope to defeat Ahmadinejad today."

Outside the same polling station, 29-year-old Abbas Rezai said he, his wife and his sister-in-law all voted for Ahmadinejad.

"We will have him as a president for another term, for sure," he said.

Iranians around the world also took part in the vote. In Dubai, home to an estimated 200,000 Iranians, the streets around the polling station at the Iranian consulate were jammed with voters overwhelmingly favoring Mousavi.

"He is our Obama," said Maliki Zadehamid, a 39-year-old exporter.

Global response

In southern California and elsewhere in the U.S., Iranian expatriates and their children gathered at voting sites set up in hotels and mosques and staffed by volunteers. Many said they were voting for Mousavi.

Shahab Baniadam, 51, said he had been in the United States for 30 years and was voting in an Iranian election for the first time, casting his ballot for Mousavi because he "seems like a reasonable person."

In Tehran's affluent northern districts -- which strongly back Mousavi -- voters waited for up to an hour to cast ballots. Mahdi Hosseini, a university student, sharply criticized Ahmadinejad for "degrading Iran's image in the eyes of the world."

Ahmadinejad brought international condemnation by repeatedly questioning the Holocaust.

Mousavi also hammered Ahmadinejad for mismanaging the economy, burdened by double-digit inflation and chronic unemployment despite vast oil and gas riches. And, for the first time in Iran, the forces of the web were fully harnessed in an election showdown and catapulted Mousavi into political star.

Mousavi's stunning rise also has been helped by his popular and charismatic wife, former university dean Zahra Rahnavard, and their joint calls for more rights and political clout for women. Iranian women work in nearly all levels of society -- including as parliament members. But they face legal restrictions on issues such as inheritance and court testimony, where their say is considered only half as credible as a man's.

After casting his vote in the white ballot box, the Supreme Leader Khamenei urged Iranians to remain calm.

"As far as I see and hear, passion and motivation is very high among people," Khamenei told reporters. "If some intend to create tension, this will harm people."

The race will go to a runoff on June 19 if no candidate receives a simple majority of more than 50 per cent of the votes cast. Two other candidates -- conservative former Revolutionary Guard commander Mohsen Rezaei and moderate former parliament speaker Mahdi Karroubi -- only got a fraction of the votes, according to the interior ministry's results.