"I confirm the vote and appoint you as president of the republic," Khamenei said on at a ceremony in Tehran that was attended by Iranian officials and foreign dignitaries.

Addressing religious, military and political leaders, ayatollah Khamenei, Iran's top authority, prayed for "the success of a worthy person".

Symbolizing the endorsement, Khamenei handed over the presidential mandate to Rouhani. He kissed Rouhani on the cheek and the new president kissed the leader on his shoulder, a sign of supplication.

Former President Mahmud Ahmadinejad, who was prevented from running in the May vote, and Rouhani's main rival in the vote, hard-line cleric Ebrahim Raisi, were among those attending the ceremony.

The ceremony took place against a different political backdrop. Most conservatives and hard-liners, loyal to Khamenei have unleashed a barrage of criticism against Rouhani in recent months.

The attacks extend to the nuclear deal reached with the world powers in 2015. They accuse Rouhani that too much was given away in return for very little economic benefit.

However, it is widely believed that the supreme leader endorsed the nuclear negotiations and closely followed every step. Without his blessing, it is hard to imagine Rouhani would have been able to sign any agreement.

In Thursday’s ceremony, Rouhani staunchly defended the nuclear deal. "The nuclear deal is a sign of Iran's goodwill on the international stage," he said.

The second main event of the inauguration will take place on Saturday, August 5 when Rouhani is due to take the oath of office at the Iranian parliament.

Since the establishment of the Islamic Republic, twelve presidential elections have taken place and seven people have occupied the office – Abolhassan Bani-Sadr (currently in exile in France), Mohammad Ali Rajaei (assassinated), Ali Khamenei (currently supreme leader), Akbar Hashemi Rafsanjani (deceased), Mohammad Khatami (officially under a travel and public appearance ban), Mahmoud Ahmadinejad (under investigation and reported indictment) and Hassan Rouhani.