Iran’s leading mullah blasted an “unstable” President Trump​ ​for grandstanding when he tweeted support for protesters rallying against the government during days of unrest​ that rocked the Islamic Republic.​

“​T​his 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​,​”​ ​Ayatollah Ali Khamenei tweeted​ on Tuesday, according to Reuters.​

​Trump expressed solidarity with the anti-government protesters after rallies against high food prices turned into demonstrations against the unelected clerical leaders.

​​“The people of Iran are finally acting against the brutal and corrupt Iranian regime,” ​Trump posted on Twitter last week. “​… ​The people have little food, big inflation and no human rights. The U.S. is watching!”

The Iranian leader in his comments appeared to be taking a cue from a best-selling tell-all about the Trump White House that characterized the president and his administration as “an idiot surrounded by clowns.”

Trump took to Twitter over the weekend to boast of his intellect.

“​Actually, throughout my life, my two greatest assets have been mental stability and being, like, really smart,” he wrote on the social messaging site​ Saturday​. “I went from VERY successful businessman, to top T.V. Star………to President of the United States (on my first try). I think that would qualify as not smart, but genius….and a very stable genius at that!”

Khamenei blamed the United States, Britain and Israel for instigating the protests in an effort to overthrow the government — an effort he said has been thwarted.

“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 powerful Revolutionary Guard on Sunday declared that its forces had ​put an end to the protests that stretched for more than a week and resulted in the deaths of 22 people and the arrests of hundreds.

Khamenei said the protesters were “playing with fireworks,” but admitted citizens have the right to air their concerns — a startling statement from a leader who usually takes a hard-line approach to dissent.

“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.