The nuclear deal was engineered by the Rouhani administration and went into effect in 2016.
Rouhani said maintaining national security was one of his government's most important goals and stressed that "the ominous shadow of the war (over the country) has disappeared".
"His advice does not prevent me from running", he said.
Ardavan Amir-Aslani, a French-Iranian lawyer who advises European companies setting up in Iran, said he would be surprised if Rouhani does not win re-election despite the economic malaise. In addition to Ahmadinejad, who registered earlier last week, Rouhani is likely to face a strong challenge from the 56-year-old Raisi, who can attract conservative voters from Iran's provinces.
Still, Reuters notes that the lack of hardline unity in the run-up to the election has been preserved in part by Supreme Leader Ali Khamenei's declining to intervene or express specific support for one hardline candidate.
"Our relations will be ongoing with every country - except the occupying regime of Israel - but on condition of respect", Raisi said.
"We have always declared that strengthening the defense capability of Iran's armed forces is only meant for defending our country and will never be used against other countries", he said.
During the registration in Iran's Interior Ministry, Ahmadinejad, expressed hope for victory. Ahmadinejad previously served two four-year terms from 2005 to 2013 pushing forward Iran's nuclear program despite worldwide opposition.
Seen as a proxy for Ahmadinejad after the former president was told not to stand by the supreme leader.
Associated Press journalists watched as Rouhani, 68, registered on the fourth day of the allocated period which ends on Saturday evening.
"There is extensive pressure on me from dear people of different walks of life as their small servant to come to the election".
All hopefuls will be vetted by the Guardian Council, a body that oversees elections and legislation, from April 16 to April 20. The large list of potentials will be whittled down by the Guardian Council and final selection based on political and Islamic qualifications announced on April 27, ahead of the ballot in May 19.
Most of the analysts believe that Rouhani, Raisi and Ahmadinejad will be the three major candidates with political weight and ideological reflection, whose competition can heat up the furnace of election in Iran next month.