Mr Rouhani was elected by a landslide in 2013, on a platform of ending the country’s diplomatic isolation and creating a freer society.

Image copyrightAFP/ GETTY

Image caption
Ebrahim Raisi is a cleric and judge with a reputation for his uncompromising stance

Two years later his government and six other countries reached a landmark deal, in which Iran agreed to curb its sensitive nuclear activities in return for the lifting of economic sanctions.

Mr Raisi is a seyed, meaning he traces his genealogy back to the Prophet Muhammad. He has a reputation for his uncompromising stance on key issues and is rumoured to be supported by Supreme Leader Ayatollah Ali Khamenei.

Last year the Supreme Leader warned Mr Ahmadinejad that such a move was “not in his interest and that of the country”.

Mr Khamenei appoints about half of the Guardian Council.

Mr Rouhani and Mr Raisi are expected to focus their campaigns on the state of the economy as well as the nuclear deal, which has been hailed by the president as his most significant success over the four years he has been in office.

Other candidates given the go-ahead to compete in the vote are Mostafa Mirsalim, Tehran mayor Mohammad Bagher Ghalibaf, Mostafa Hashemitaba and Vice President Eshaq Jahangiri.