Both President Mahmoud Ahmadinejad and his top rival are claiming victory in Iran's presidential election.

"I am the definite winner of this presidential election," moderate Mirhossein Mousavi declared just after voting ended, according to Reuters.

Yet less than an hour later, the state's official news agency reported that Ahmadinejad had won.

"Doctor Ahmadinejad, by winning most votes at the 10th presidential election, has secured his victory," the Islamic Republic News Agency (IRNA) claimed.

For his part, Mousavi has complained of widespread voting irregularities that raise doubts about the election's fairness.

"[We] are waiting for the counting of votes to officially end and explanations of these irregularities be given," Mousavi said after claiming victory. "We expect to celebrate with people soon."

If neither candidate ends up with a majority of votes, the Mousavi and Ahmadinejad would compete in a runoff.