It also makes Ahmadinejad the most high-profile Iranian politician to defy the wishes of Supreme Leader Ayatollah Ali Khamenei, who has the final say in all state matters.
But many hardliners in Iran are seeking a tough-talking candidate who can stand up to Donald Trump.
The former president's chances at recapturing the office, though, seem highly unlikely - at least from a qualifying standpoint. Associated Press journalists who witnessed Ahmadinejad's registration on Tuesday said election officials were "stunned" when he submitted the paperwork.
"The irony is that by spoiling the conservatives' game and taking away from Raisi's voter-base, Ahmadinejad is in fact aiding Rouhani's re-election", said senior Iran analyst Ali Vaez of the International Crisis Group.
But the former president - whose tenure between 2005 and 2013 saw mass protests at home, plummeting relations with the West and a shattered economy - surprised everyone when he registered along with Baghaie on Wednesday. Ahmadinejad remains a deeply polarizing figure, even among hard-liners, and his decision to register for the election could be a political stunt to try to remain relevant.
During Ahmadinejad's administration, Iran faced heavy global sanctions against for its nuclear program, which Western countries said aimed to develop weapons. While the deal eased global sanctions in return for curbs on the country's nuclear programme, the trickle-down effects are yet to be felt by many of Iran's 80 million strong population.
South Korean supporters of arrested ex-president to protest
Thousands of supporters of arrested former President Park gather in South Korea's capital on Saturday to call for her release. Park has apologized for putting trust in her jailed friend, Choi Soon-sil, but has denied breaking laws.
Abe praises Trump's security commitment after call on Syria, North Korea
Commerce Secretary Wilbur Ross said the US wants to see "tangible results" - and soon - on its trading relationship with China. Trump said instead the two sides made " tremendous progress ", while striking a tone of optimism about future negotiations.
AUDIO: Royals Silent In Home Opener
Monday's ceremony included a saxophonist playing "Amazing Grace" and several of Ventura's teammates laying a banner on the mound. We just have to play for him. "The wind was blowing out so hard and ball hit that high, it just took off".
Internationally, he is more known for repeatedly questioning the scale of the Holocaust, predicting Israel's demise and expanding Iran's nuclear programme.
The memory of the 2009 unrest likely sparked Khamenei's comments in September. The council has six Islamic experts, hand-picked by the supreme leader, and six legal experts elected by the parliamentary Majilis.
The candidate registration for the upcoming election will last for five days.
Former populist President Mahmoud Ahmadinejad announces his intention to run for president in the May 2017 presidential elections.
Baghaei, who was imprisoned for seven months after he left office, registered alongside Ahmadinejad on Wednesday. In March, the judiciary said the case was still open, Reuters news agency reports.