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

Rohani, a 68-year-old self-proclaimed moderate, won a second term in May.

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

In his comments at the ceremony, Rohani called for unity.

"I extend my hand to all those who seek the greatness of the country,” he said, while also vowing to continue his efforts to improve ties with the world.

"We will never accept isolation," Rohani said.

"The nuclear deal is a sign of Iran's goodwill on the international stage," he said, referring to the 2015 nuclear agreement with world powers under which Iran has limited its controversial nuclear activities in exchange for sanctions relief.

Rohani is due to take the oath of office at the Iranian parliament on August 5.