Iranian President Hassan Rouhani pledged today to open Iran to the world and deliver freedoms its people have yearned for, throwing down a defiant challenge to his hardline opponents after securing a decisive re-election for a second term.

Mr Rouhani, long known as a cautious and mild-mannered establishment insider, reinvented himself as a bold champion of reform during the election campaign, which culminated yesterday in victory with more than 57% of the vote. His main challenger, hardline judge Ebrahim Raisi, received 38%.

In his first televised speech after the result, Mr Rouhani appeared to openly defy conservative judges by praising the spiritual leader of the reform camp, former President Mohammad Khatami. A court has banned quoting or naming Mr Khatami on air.

"Our nation's message in the election was clear: Iran's nation chose the path of interaction with the world, away from violence and extremism," Mr Rouhani (below) said. He promised to serve as president for all Iranians, not just those who voted for him.

Although the powers of the elected president are limited by those of unelected Supreme Leader Ayatollah Ali Khamenei who outranks him, the scale of Mr Rouhani's victory gives the pro-reform camp its strongest mandate in at least 12 years to seek the sort of change that hardliners have thwarted for decades.

And it delivers a setback to the Revolutionary Guards (IRGC), the powerful security force which controls a vast industrial empire in Iran. They had thrown their support behind Mr Raisi to safeguard their interests.

Hassan Rouhani

Thousands of people gathered in central Tehran to celebrate Mr Rouhani's victory. Videos on social media showed young people clapping and chanting "We love you Hassan Rouhani, we support you".

Some youngsters wore wristbands in violet, the colour of Mr Rouhani's campaign. Others wore green, representing the reformist movement crushed by security forces after a 2009 election, whose leaders have been under house arrest since 2011.

During campaigning, Mr Rouhani promised to seek their release if re-elected with a stronger mandate.

"We won. We've done what we should have for our country. Now it's Rouhani's turn to keep his promises," said coffee shop owner Arash Geranmayeh, 29, reached by telephone in Tehran.

Mr Rouhani, 68, faces the same limits on his power to transform Iran that prevented him from delivering social change in his first term, and that thwarted Mr Khatami, who failed to deliver on a reform agenda as president from 1997-2005.

But by publicly thanking "my dear brother, Mohammad Khatami" in his victory speech, Mr Rouhani seemed to take up that mantle. It was a remarkable challenge to the religious judicial authorities, who have blacklisted Mr Khatami from public life for his support for other reformists under house arrest.

Many experts are sceptical that a president can change much in Iran, as long as the supreme leader has veto power over all policies and control over the security forces. Some said the pattern was all too familiar from Mr Rouhani's first victory four years ago and Mr Khatami's victories the previous decade.