Mahmoud Ahmadinejad, right, meets with Supreme Leader Ayatollah Ali Khamenei after his 2005 presidential election victory. (Raheb Homavandi/Reuters)

Former Iranian president Mahmoud Ahmadinejad has been effectively blocked from seeking a return to office after Iran’s supreme leader decided that the firebrand populist would prove too divisive in next year’s election, state media reported Monday.

The comments by Ayatollah Ali Khamenei signaled a preemptive strike against possible attempts by Ahmadinejad to build a movement to challenge the reform-minded Hassan Rouhani in the May presidential election.

Khamenei’s remarks, carried by the official Islamic Republic News Agency, also suggested that Rouhani and his government still retain some support among Iran’s ruling clerics after being given the green light to negotiate last year’s nuclear deal with the United States and other world powers.

Ahmadinejad has remained mostly out of the public eye since leaving office. But his anti-Western rhetoric and combative style still resonate among many Iranian conservatives, and he was widely viewed as among the most formidable political figures capable of unseating Rouhani.

Ahmadinejad, who served two terms from 2005 to 2013, had not publicly announced plans to seek a political comeback. But he has made policy speeches and other outreach recently, fueling speculation that he may want to challenge Rouhani.

Iran sets a limit of two consecutive presidential terms, but it is possible to run again after being out of office.

Ahmadinejad “came to me and I told him not to stand” for the election, Khamenei said, according to IRNA.

“It will create polar opposites and divisions in the country, which I believe is harmful,” the supreme leader added, according to the report.

Khamenei, who has final say in all major state affairs, cannot technically block a candidate on his own. But an oversight group closely aligned with him and the ruling clerics vets all names for major elections.

Khamenei’s comments appear to sink any potential plans for another run by Ahmadinejad, whose disputed reelection in 2009 set off the most serious unrest in Iran since the 1979 Islamic revolution. Ahmadinejad further antagonized the West with diatribes against Israel and questions about historical accounts of the Holocaust.

A former hard-line member of Iran’s parliament, Gholamreza Mesbahi Moghadam, confirmed Khamenei’s comments on the news website Khabar Online, the Associated Press reported.

Khamenei also could be dealing a bit of payback to Ahmadinejad, who openly feuded with the ruling clerics during his final years in office over issues such as cabinet appointments.

Rouhani’s political base includes many who have opposed the ruling system and its heavy hand against critics, including the house arrest of two leading opponents of Ahmadinejad in the 2009 election. But Rouhani received crucial backing from Khamenei to move ahead with the talks that led to the nuclear pact, which set limits on Iran’s uranium-enrichment program in exchange for the easing of many international sanctions.

It is unclear who will seek to challenge Rouhani on next year’s ballot. Candidates are normally not approved until several months before the vote. Last month, a prominent commander in the powerful Revolutionary Guard Corps, Maj. Gen. Qasem Soleimani, said he did not plan to seek the presidency.