Ahmadinejad previously said he wasn't going to run after Supreme Leader Ayatollah Ali Khamenei advised him not to. But many hard-liners in Iran seek a tough-talking candidate to rally around who can stand up to U.S. President Donald Trump.

Iran's moderate President Hassan Rohani, who negotiated the nuclear deal with world powers, is expected to run for re-election.

Ahmadinejad's candidacy also could expose the fissures inside Iranian politics that linger since his contested 2009 re-election, which brought massive unrest.

"It was an organized mutiny against the Iran's ruling system," said Soroush Farhadian, who backs reformists.

Ahmadinejad previously served two four-year terms from 2005 to 2013. Under Iranian law, he became eligible to run again after four years out of office, but he remains a polarizing figure, even among fellow hard-liners.

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 because of Western suspicions that Tehran was secretly pursuing nuclear weapons. Iran insists its nuclear program is for peaceful purposes.

Ahmadinejad's disputed re-election in 2009 sparked massive protests and a sweeping crackdown in which thousands of people were detained and dozens were killed.

Internationally, Ahmadinejad is more known for repeatedly questioning the scale of the Holocaust, predicting Israel's demise and expanding Iran's contested nuclear program.

The memory of the 2009 unrest likely sparked Khamenei's comments in September. At that time, he recommended an unnamed candidate not seek office as it would bring about a "polarized situation" that would be "harmful for the county."

Ahmadinejad described comments by the supreme leader suggesting he not run as "just advice" in a news conference shortly after submitting his registration. There was no immediate reaction from the supreme leader's office.

He said his decision to run was intended to help former Vice President Hamid Baghaei, a close confidant. Baghaei registered alongside Ahmadinejad on Wednesday, as did Esfandiar Rahim Mashaei, another of the former president's close allies.

More than 120 prospective candidates submitted their names as candidates on the first day of registration Tuesday, including six women and seven clerics. Registration remains open until Saturday.

Under Iran's electoral system, all applicants must be vetted by the Guardian Council, a clerical body that will announce a final list of candidates by April 27. The council normally does not approve dissidents or women for the formal candidate list.

The May 19 election is seen by many in Iran as a referendum on the 2015 nuclear agreement with world powers and its ability to improve the country's sanctions-hobbled economy. Under that deal, Iran agreed to curb its uranium enrichment in exchange for the lifting of international sanctions.

Since the deal, Iran has signed multi-billion-dollar contracts with airplane manufacturers Boeing Co. and Airbus. The benefits have yet to trickle down to the average Iranian, however, fueling some discontent.