Mahmoud Ahmadinejad
Mahmoud AhmadinejadReuters

Iran's former president Mahmoud Ahmadinejad on Tuesday announced he will not stand for re-election, AFP reported.

His announcement comes the day after Iranian media reported that Iran’s Supreme Leader, Ayatollah Ali Khamenei, had ordered Ahmadinejad not to run in next year’s elections.

"In following the will of the great leader of the revolution, I have no plans to be present in next year's presidential competitions," Ahmadinejad wrote in a letter to Khamenei made public by Iranian media on Tuesday.

Khamenei, in cautiously worded remarks and without naming the ex-president, indicated a day earlier that his standing again would be a mistake.

"A certain person came to me and I told him not to do a certain thing, believing it would be to the benefit of both the person himself and the country," Khamenei was quoted by AFP as having said.

He implied that an Ahmadinejad candidacy would have a polarizing effect that would "damage the country".

Ahmadinejad, who was president between 2005 and 2013, said he had met Ayatollah Khamenei on August 30.

Before Tuesday’s announcement, he had not officially announced any plans to run in the vote scheduled for May, but had launched a political campaign and made several speeches in recent months, prompting speculation of a political comeback.

"I will forever remain the small soldier of the revolution and a servant of the people," he concluded in his letter, according to AFP.

Ahmadinejad’s successor, Hassan Rouhani, is expected to stand for a second term in the May 19 vote.

Ahmadinejad is notorious for his inflammatory rhetoric, particularly over Iran's nuclear program and his hostility towards Israel.

Prior to leaving the presidency, Ahmadinejad said he prided himself the most on his denial of the Holocaust.

Rouhani's popularity surged after last year's deal with world powers that lifted most sanctions on Iran in exchange for curbs on its nuclear program.

Ahmadinejad's withdrawal from the presidential race comes as another conservative, Mohsen Rezai, former head of the elite Revolutionary Guards, also announced Monday that he would not be a candidate next May.

Another potential candidate, Revolutionary Guard Commander Qassem Soleimani, announced earlier this month he would not run.