Iran's former President Mahmoud Ahmadinejad, who made his name on the international stage as a hardliner and for his unflinching anti-Israeli rhetoric, will not seek re-election in 2017.

Ahmadinejad, who pursued nuclear expansion for Iran throughout his tenure as President from 2005 to 2013, had been believed to be seeking re-election to his former post after he began touring the country.

However, it would appear that the firebrand has taken the advice of the country's Supreme Leader Ayatollah Ali Khamenei who warned Ahmadinejad not to seek a third term after his contested 2009 election result plunged Iran into uncertainty.

"By the grace of God, I am proud to continue as a small soldier for the revolution," Ahmadinejad wrote. However, it was believed Ahmadinejad's contest of the election held in May 2017 could reopen old wounds.

His last election sparked massive protests in the country, which were met with a widespread crackdown. Thousands were detained in the aftermath, dozens killed and yet more tortured.

Analysts believed Ahmadinejad could have posed a strong challenge to moderate incumbent President Hassan Rouhani, who has presided over a rapprochement with the west and particularly the US.

"You advised me it's not expedient to run and I announced my obedience, following my explanations of my plans," Ahmadinejad wrote in a letter to Khamenei. "I hereby inform you regarding the supreme leader's considerations, I have no plan for next year's elections."

Ahmadinejad used his position on the international stage to deny the scale of the Holocaust and regularly call for the destruction of Israel.

Two of his former vice presidents have been jailed for corruption since he left office –and Iran's economy suffered under the pressure of US sanctions, worsened by suspicions Khamenei was seeking a nuclear weapons programme.

With Ahmadinejad now out of the running it is unclear who hard-line factions in Iran will put forward as a candidate with the ability to beat Rouhani.