TEHRAN, Iran (AP) -- Iran's hard-line former president, Mahmoud Ahmadinejad, said Tuesday he won't run in next year's presidential election, ending weeks of speculation after the country's supreme leader discouraged his candidacy.
Ahmadinejad's candidacy could have posed a strong hard-line challenge to President Hassan Rouhani, who many believe will seek a second term after his administration struck the landmark nuclear accord with world powers. It also could have exposed the still-lingering wounds in Iran from the widespread unrest that followed his contested 2009 re-election.
"By the grace of God, I am proud to continue as a small soldier for the revolution," Ahmadinejad said in a letter to Supreme Leader Ali Khamenei.
Ahmadinejad, known for repeatedly questioning the scale of the Holocaust, prognosticating Israel's demise and expanding Iran's contested nuclear program, had been touring the country, fueling rumors of his potential candidacy. He also wrote and publicly released a letter to President Barack Obama in August asking him to "quickly fix" a U.S. Supreme Court ruling that allows families of people killed in attacks linked to Iran to collect damages from the country's frozen assets.
Ahmadinejad previously served two four-year terms from 2005 to 2013. Under Iranian law, he became eligible to run again after four years.
However, Ahmadinejad as a candidate recalls some memories Iran may want to forget.
Two of his former vice presidents have been jailed for corruption since he left office. Iran's economy suffered under heavy international sanctions during his administration, which were sparked by Western fears that the Islamic Republic's nuclear program would be used to build atomic bombs. Iran insists its program is for peaceful purposes.
Internally, many associate Ahmadinejad with the aftermath of Iran's 2009 presidential election. He ended up winning in a contested vote count that sparked massive protests and a security force crackdown that saw thousands detained, dozens killed and others tortured.
The memory of the unrest likely sparked comments Monday by Khamenei, who said he recommended an unnamed candidate not seek office as it would spark a "polarized situation" that would be "harmful for the county."
In his letter Tuesday, Ahmadinejad confirmed Khamenei was referring to him in the oblique comments.
"You advised me it's not expedient to run and I announced my obedience, following my explanations of my plans," Ahmadinejad wrote. "I hereby inform you regarding the supreme leader's considerations, I have no plan for the next year's elections competition."
Ahmadinejad also said their meeting came Aug. 30. It wasn't immediately clear what transpired in the weeks between, though it appears Khamenei's comments Monday likely pushed Ahmadinejad into making his announcement.
Without Ahmadinejad in the running, it's unclear whether hard-liners will be able to put up a candidate with similar name recognition to challenge a possible Rouhani run. All Iranian presidents since Khamenei took the presidency in 1981 have served two four-year terms in Iran's cleric-governed democracy.
Potential presidential candidates also are barred from publicly campaigning for the May 17 election until roughly the end of April, making picking out possible challengers even more difficult.