Comments on his Twitter feed and in Iranian media underscored the establishment's confidence that it has extinguished the unrest that spread to more than 80 cities in which at least 22 people died since late December.
"Once again, the nation tells the US, Britain, and those who seek to overthrow the Islamic Republic of Iran from abroad that 'you've failed, and you will fail in the future, too,'" Khamenei tweeted.
The Revolutionary Guards, the military force loyal to Khamenei, said on Sunday security forces had put an end to the unrest that it said had been whipped up by foreign enemies.
At least 1,000 people have been arrested in the biggest anti-government protests for nearly a decade, with the judiciary saying ringleaders could face the death penalty.
Khamenei said US President Donald Trump was grandstanding when he tweeted support for protesters he said were trying "to take back their corrupt government" and promising "great support from the United States at the appropriate time!"
The Iranian leader tweeted: "... this man who sits at the head of the White House - although, he seems to be a very unstable man—he must realize that these extreme and psychotic episodes won't be left without a response."
As well as Washington and London, Khamenei blamed the violence on Israel, exiled dissident group Mojahedin-e-Khalq and "a wealthy government" in the Gulf, a reference to Iran's regional rival, Saudi Arabia.
Khamenei has called the protests—which were initially about the economy but soon turned political—"playing with fireworks," but he said citizens had a right to air legitimate concerns, a rare concession by a leader who usually voices clear support for security crackdowns.
"These concerns must be addressed. We must listen, we must hear. We must provide answers within our means," Khamenei was quoted as saying, hinting that not only the government of President Hassan Rouhani, but his own clerical leadership must also respond.
"I'm not saying that they must follow up. I am also responsible. All of us must follow up," Khamenei said.