TEHRAN - Iran's Supreme Leader Ayatollah Ali Khamenei on Friday demanded an end to street protests that have shaken the country since the disputed presidential election a week ago and said any bloodshed would be their leaders' fault.

(Editors' note: Reuters and other foreign media are subject to Iranian restrictions on their ability to report, film or take pictures in Tehran.)

He defended Mahmoud Ahmadinejad as the rightful winner of the vote and denied any possibility that it had been rigged, as Ahmadinejad's opponents have alleged.

If there is any bloodshed, leaders of the protests will be held directly responsible, Khamenei said in his first address to the nation since the upheaval began.

The result of the election comes from the ballot box, not from the street, the white-bearded cleric told huge crowds thronging Tehran University and surrounding streets for Friday prayers. Today the Iranian nation needs calm.

Supporters of runner-up Mirhossein Mousavi have called another rally on Saturday. If they proceed in defiance of Khamenei's explicit warning, they risk a severe response from security forces, which have so far not tried to prevent mass demonstrations.

State media have reported seven or eight people killed in protests since the election results were published on June 13. Scores of reformists have been arrested and authorities have cracked down on foreign and domestic media.

Mousavi has called for the annulment of the election result, which showed he won 34 percent of the votes to Ahmadinejad's tally of nearly 63 percent.

Iran's top legislative body, the Guardian Council, is considering complaints by the three losing candidates, but has said only that it will recount some disputed ballot boxes.

Khamenei said any election complaints should be raised through legal channels.

I will not succumb to illegal innovation, he said, in an apparent reference to the most widespread street protests in the Islamic Republic's 30-year history.

START OF DICTATORSHIP

Khamenei's address followed six days of protests by Mousavi supporters. On Thursday, tens of thousands of black-clad marchers carried candles to mourn those killed in earlier rallies.

He said defeated candidates were wrong to believe that by using street protests as a pressure tool, they can compel officials to accept their illegal demands. This would be the start of a dictatorship.

He dismissed charges by Mousavi supporters of fraud. Iran's laws do not allow vote-rigging, especially at the level of 11 million, he said, referring to Ahmadinejad's victory margin.

The enemies of Iran, the world's fifth biggest oil exporter, were targeting the legitimacy of the Islamic establishment by disputing the outcome of the election, he said.

State television coverage showed Ahmadinejad and defeated candidate Mohsen Rezaie attending Khamenei's speech.

There was no sign of Mousavi or two former presidents who have backed him -- reformist Mohammad Khatami and the powerful Akbar Hashemi Rafsanjani, who clashed with Ahmadinejad before the election in a rare display of leadership division.

The supreme leader, Iran's ultimate authority, in theory stands above the factional fray, but Khamenei acknowledged his views on foreign and domestic policy were closer to those of the hardline Ahmadinejad than of Rafsanjani.

He attacked what he called interference by foreign powers which had questioned the result of the election.

American officials' remarks about human rights and limitations on people are not acceptable because they have no idea about human rights after what they have done in Afghanistan and Iraq and other parts of the world. We do not need advice on human rights from them, he said.

Many European countries and international human rights organizations have criticized the election and its aftermath, but U.S. President Barack Obama's administration has muted its comments to keep the door ajar for possible dialogue.

People chanting slogans and holding posters of Khamenei, Ahmadinejad and the late Ayatollah Ruhollah Khomenei, the father of the 1979 Islamic revolution, packed streets outside the university.

Outside the university compound, thousands listened intently to his speech booming from loudspeakers set up along the street, at times cheering and chanting to voice their approval for his words.

At the same venue, hundreds of university students had demonstrated in support of Mousavi on Sunday, throwing stones at riot police trying to disperse protesters outside the gates.

With this speech, the leader has finished all problems, one middle-aged cleric in the crowd said afterwards. The differences between the politicians will be resolved.

Some in the crowd for Friday prayers were draped in Iranian flags. Others held placards with anti-Western slogans.

Don't let the history of Iran be written with the pen of foreigners, one flyer said, reflecting official Iranian anger at international criticism of the post-election violence.

(Additional reporting by Dominic Evans and Hashem Kalantari in Tehran; Editing by Alistair Lyon and Andrew Dobbie)