Iran's President Hassan Rouhani won a second term on Saturday, four years after first taking office on the back of a pledge to reduce the country's international isolation.

His resounding victory came after a hard-fought election campaign in which he promised to increase Iran's engagement with the world and improve civil rights domestically.

Rouhani was born in 1948 in Sorkheh, northern Iran, into a family that opposed the former Shah of Iran, and has held various roles in government since the Islamic Revolution. Before winning the 2013 presidential elections, he was a member of the Supreme National Security Council, a position he held since 1989.

He began studying religion at an early age. In the 1960s, he went to religious seminaries and began attending classes taught by prominent Shia scholars. In 1969, he attended the University of Tehran and received his bachelor's degree in judicial law three years later.

In addition to religious studies, he was interested in learning modern sciences, going on to receive a master's degree in public law along with a doctorate at Glasgow Caledonian University in Scotland.

He began his political career in the 1960s by following the exiled leader of the Islamic movement, Ayatollah Khomeini. Rouhani continued to be outspoken against the Shah up until 1977, when he was forced to flee Iran after publicly declaring Khomeini an "imam".

After the overthrow of the Shah in 1979, Rouhani returned to Iran to help stabilise the fledgling Islamic Republic.

Since the government takeover of the Islamic Revolution, Rouhani has held multiple positions, including Secretary and Representative of the Supreme National Security Council, member of the Assembly of Experts, member of the Expediency Discernment Council, President of the Center for Strategic Research, and multiple roles in Parliament.

After the election of Mahmoud Ahmadinejad in August 2005, Rouhani, an outspoken critic of the former president, resigned from his post as secretary of the Supreme National Security Council after having held the job for 16 years. Rouhani also served as Iran's top nuclear negotiator from October 2003 up until his resignation from the SNSC.

Rouhani earned the nickname "the diplomat sheikh" because of his clerical background and leading role in nuclear negotiations. And he made diplomacy a theme of his first address as president back in 2013.

"The only way for interaction with Iran is dialogue on an equal footing, confidence-building and mutual respect as well as reducing antagonism and aggression," Rouhani told parliament after taking his oath of office.

"If you want the right response, don't speak with Iran in the language of sanctions, speak in the language of respect," he said.

During his first term, Iran reached a landmark deal in 2015 to curb its nuclear programme in exchange for sanctions relief.

Addressing the Iranian nation after the announcement of the agreement, which ended many sanctions, Rouhani said: "We didn't ask for charity. We asked for fair, just and win-win negotiations."

He said that "a new chapter has started" and said the government could now focus on other issues of the country.

However, after Donald Trump became president of the US, tensions between the two countries increased, especially following the Muslim ban that barred Iranian citizens from entering the US.

Although he campaigned on equal rights and equal pay for women, releasing political prisoners and lifting sanctions, Rouhani faced intense criticism during the election period over his economic record, even though he managed to bring down runaway inflation.

His rivals and Iran's supreme leader, Ayotollah Khamenei, have pointed out that Rouhani's diplomatic efforts did little to tackle high unemployment and persistent poverty.

The slow pace of change has left many in the country frustrated, increasing pressure on the re-elected president to deliver on his campaign promises.