Khamenei confirmed Ahmadinejad in office as the government moved to put on trial people accused of staging protests that followed the disputed June 12 presidential election.
Iranian officials, accusing the US, Britain and other Western powers of stoking the unrest, had previously portrayed the protests as a foreign-supported attempt to overthrow the Islamic Republic.
Mir Hossein Mousavi, a reformist presidential candidate in the elections, and Mehdi Karroubi, another opposition candidate, led protests in the wake of the elections, sparking a major crackdown by the police and the detention of hundreds of people.
In the statement, read over his pictures, Khamenei added: "This plot was defeated, since fortunately our enemies still do not understand the issue in Iran.
"Our enemies were given a slap in face by the Iranian nation, but they are still hopeful and they are pursuing the issue."
Seyed Mohammad Marandi, a political analyst at the University of Tehran, told Al Jazeera that Khamenei said in a meeting with students on Wednesday that the judiciary "must come down and will come down hard on all those who have committed violations".
"He said they will be firm in dealing with any injustices and any crimes but they will also be fair," said Marandi.
Khamenei's comments coincided with the remarks of a senior Iranian cleric who sharply criticised the supreme leader, saying Iran is being ruled by a dictatorship.
Grand Ayatollah Hossein Montazeri said on Wednesday that the ruling system under Khamenei had misused Islam in its crackdown against opposition supporters.
He said Iranian authorities also showed their true nature with the violent suppression of hundreds of thousands of demonstrators who filled the streets of the capital, Tehran, to protest against the results.
"The biggest oppression ... is despotic treatment of the people in the name of Islam," the Associated Press news agency reported, citing a statement from Montazeri posted on his website.
"The biggest oppression ... is despotic treatment of the people in the name of Islam"
Grand Ayatollah Hossein Montazeri
"I hope the responsible authorities give up the deviant path they are pursuing and restore the trampled rights of the people," he wrote.
"I hope authorities ... have the courage to announce that this ruling system is neither a republic nor Islamic and that nobody has the right to express opinion or criticism."
Al Jazeera's Alireza Ronaghi, reporting from Tehran, said Montazeri's statement is significant because he was once in line to succeed the late Ayatollah Ruhollah Khomeini [Khamenei's predecessor] as Iran's supreme leader.
But Montazeri was passed over for criticising what he called the excesses of the 1979 Islamic Revolution.
"He has been a vocal critic of the government and what he is saying now is only harsher in tone," our correspondent said.
"Because of what has happened after the election, Ayatollah Montazeri, as well as some other critics of the Islamic Republic, find it necessary to put more pressure on the Islamic government by at least adopting a harsher tone," he said.
But Marandi told Al Jazeera that Montazeri has been "saying the same thing for around 25 years".
He said the cleric was also saying the same thing during the rule of Ayatollah Khomeini.
"After his inner circle was discovered to be linked to Mujahedin terrorists based in Iraq, he was isolated by the reformists. He is not a major player and has always been very critical," said Marandi.