Ex-Iranian President Mahmoud Ahmadinejad has unexpectedly filed to run in the country's May presidential election, state media reports.
Although the move by the former hardline president on Wednesday was seen as an attempt to bolster the candidacy of an ally, it was also a challenge to Supreme Leader Ayatollah Ali Khamenei, who had ordered him not to run.
President Hassan Rouhani, a moderate who engineered Iran's 2015 nuclear deal with world powers that secured a removal of sanctions against Tehran, is expected to seek re-election but faces a stiff challenge from conservatives who oppose the deal.
Ahmadinejad, who enraged the West with his rhetoric during his eight years in office, wanted to challenge Rouhani's bid for a second term, but Khamenei ordered him in 2016 not to nominate himself.
Khamenei warned in September that Ahmadinejad's candidacy could create division in the country and harm the nation.
Ahmadinejad said in October he would abide by the order and would not run.
However, he named one of his main allies and former deputy Hamid Baghaei as a candidate.
Ahmadinejad accompanied Baghaei to the interior ministry on Wednesday for registration.