Shots have been fired at an opposition rally in Tehran where more than 100,000 Iranians were protesting against the re-election of President Mahmoud Ahmadinejad.

An Associated Press photographer saw one person killed when shots were fired from a compound for pro-government militiamen. Several other people appeared to have been seriously wounded in Tehran's Azadi Square. BBC's Persian service quoted an eyewitness saying that four protesters have been killed.

A reporter on Iran's English-language Press TV said: "There has been sporadic shooting out there ... I can see people running here."

Speaking live on the air, he said: "A number of people who are armed ... I don't know exactly who they are, but they have started to fire on people, causing havoc in Azadi Square."

Local residents said they had heard shooting in three districts of northern Tehran.

Earlier, the defeated candidate Mir Hossein Mousavi addressed the crowd in his first public appearance since Friday's disputed election. Addressing the crowd from the roof of his car, Mousavi said he was ready to compete in a fresh election."The vote of the people is more important than Mousavi or any other person," he said, according to al-Jazeera television.

The gathering followed an announcement from Iran's supreme leader, Ayatollah Ali Khamenei, that he had ordered an investigation into claims vote-rigging had given the incumbent president, Mahmoud Ahmadinejad, a landslide victory.

The rally had been banned by the authorities and was initially called off by Mousavi amid fears of violence. But tens of thousands of people, dressed in Mousavi's green campaign colours, took to the streets, chanting "God is great" and "We fight, we die – we will not accept this vote-rigging".

Calling on Ahmadinejad to resign, they said the election results were a "coup d'etat" and chanted "Death to the lying government".

"I just want to show the president that we are not bandits. I want my vote back," Maryam Sedaghati, a supporter, told Reuters.

Scuffles broke out as Ahmadinejad supporters on motorbikes used sticks to beat the marchers. Mousavi had attempted to cancel the rally after receiving warnings that militias responsible for policing it would be equipped with live ammunition. The rally had been banned by Iran's interior ministry, which declared the gathering "illegal".

Iran has been plunged into turmoil since Friday when the government declared that Ahmadinejad had won, a claim his rivals immediately disputed.

Iran's leaders spent the weekend urging people to accept the result but today Khamenei ordered an investigation into allegations of vote-rigging and fraud.

Iranian state television said he had told the guardian council, the clerical body that oversees elections, to examine Mousavi's claims of widespread vote-rigging.

The guardian council was reported to have said it would take no more than 10 days to hand down its ruling after complaints from Mousavi and another candidate, Mohsen Rezai.

"Mousavi and Rezai appealed yesterday. After the official announcement [of the appeal], the guardian council has seven to 10 days to see if it was a healthy election or not," the ISNA news agency quoted a council spokesman, Abbasali Kadkhodai, as saying.

The news represents a surprising turnaround for Khamenei, who had previously welcomed the results. "Issues must be pursued through a legal channel," state TV quoted Khamenei as saying. The supreme leader said he had "insisted that the guardian council carefully probe this letter".

Iranian TV quoted Khamenei as urging Mousavi to try to keep the violence from escalating and saying, "It is necessary that activities are done with dignity."

The UN secretary-general Ban Ki-moon today called on Iran's leaders to heed "the genuine will of Iranian people", but stopped short of fully endorsing Khamenei's call for a re-examination of the election result.

"The position of me and the United Nations is that the genuine will of Iranian people should be fully respected. I'm closely following how this investigation into this election result will come out," he said.

Ahmadinejad claimed the election results were fair and compared the protests over the past three days to the passion shown by football fans after a game.

But in a further sign of the escalating tensions, he put off a planned visit to Russia, cancelling a meeting planned for today with President Dmitry Medvedev.

Reports continued to spread that dozens of leading members of the opposition had been detained, and that security forces had last night raided a dormitory at Tehran University, killing three people and injuring 15. The reports could not be confirmed.

The official result – 63% for Ahmadinejad and 34% for Mousavi – means four more years for the president and an end to hopes for reform at home as well as, perhaps, detente with the west.

All three contenders to the presidency, reformist and conservative, have raised serious doubts about the result.

Mousavi claimed that, on Friday night, he had been informed by the interior ministry that he had won the election convincingly. That claim was first published on a popular website that was subsequently closed down.

There were also reports of a leaked interior ministry figures allegedly suggesting Mousavi had won.

EU foreign ministers today expressed "serious concern" over the fraud allegations and called for an investigation into the conduct of the election.

Small groups of Ahmadinejad supporters gathered outside the British and French embassies in Tehran, protesting at European "interference" in the elections.

Ahmadinejad has rejected claims of fraud as a "psychological war" by the foreign media.