With the deal now on shaky ground after U.S. President Donald Trump pulled out, the 69-year-old mild-mannered cleric faces the prospect of serving out his second term as a lame duck leader.
A pragmatic politician with an impeccable background in Iran's clerical establishment, Rouhani came into his own in 2013 when Supreme Leader Ayatollah Ali Khamenei needed to shore up the establishment's legitimacy.
Already threatened in 2009 when millions of Iranians took to the streets to protest against alleged election fraud, Iran's rulers came under mounting Western pressure in 2013 over the country's nuclear programme and concerns Israel might attack.
Rouhani, who established a track record for bridge-building in nuclear talks with European powers a decade earlier, promised change and in 2013 he secured the votes of pro-reform Iranians who had been politically muzzled for years.
Elected in a landslide, Rouhani opened the door to nuclear diplomacy with six major powers to try to lift the sanctions that had held back Iran's economy for years and meet the demands of young, restless Iranians.
But he was fiercely criticised by hardliners in Iran wary of opening up to the West, first for re-engaging and then for agreeing in 2015 to curb the country's nuclear programme in return for the easing of sanctions.
Trump's announcement that he will reimpose U.S. economic sanctions on Iran to undermine the nuclear deal is now expected to shift the balance of power against Rouhani.
Aware hardliners could try to exploit the shift in U.S. policy, Rouhani quickly said Iran could remain in the pact with other Western powers.
"If we achieve the deal's goals in cooperation with other members of the deal, it will remain in place," Rouhani said in a televised speech on Tuesday.
But Trump's decision is seen playing into the hands of Khamenei and his allies who control the judiciary, security forces, public broadcasters, the council which vets election candidates and laws, as well as the powerful foundations that run much of the economy.
Any new U.S. sanctions will also raise the cost of trade for Iran and are expected to further deter Western companies from investing, giving hardliners an excuse to cement their grip on power by making Rouhani a scapegoat for hardship.
"Historically, Iranian presidents are weaker in their second terms. Now, with the deal collapsing, Rouhani will be even weaker," said an Iranian diplomat, who declined to be named.
"Khamenei prefers a weak president. Rouhani will serve his term, but as a lame duck," the diplomat said.
But he has since come under pressure from many ordinary Iranians who are losing faith in his ability to deliver the greater economic and political prosperity they voted for.
In January, Iranian security forces quelled nation-wide anti-government protests over youth unemployment, high living costs and alleged corruption.
Some prominent reformist politicians and rights activists have accused Rouhani of rolling over to hardliners since being re-elected and there have been calls for him to quit. His allies blame Khamenei's hardline rivals for the deteriorating human rights situation in Iran.
"He is a regime insider. One of them. Why should he fight for us when his own political career and position could be endangered? I have no faith in him anymore," said Reza Azarpanah, a 32-year-old construction worker who voted for Rouhani in 2017.
Rouhani was born into a religious family of farmers and carpet weavers in the central province of Semnan, where his father owned a spice shop and had links to clerics in Iran's holy Shi'ite city of Qom.
Active in the revolution that overthrew the U.S.-backed Shah in 1979, Rouhani studied at the seminary school in Qom and changed his family name from Fereidun to Rouhani, or cleric in Farsi, according to his official biography.
Before becoming president, he also represented Khamenei for 25 years at Iran's Supreme National Security Council, which has authorised the suppression of popular unrest, as well as the house arrest of Iranian opposition leaders in 2011.
Rouhani, who has a PhD in law from Glasgow Caledonian University, gained prominence abroad when he presided over nuclear talks with Britain, France and Germany.
The discussions led to Iran agreeing in 2003 to suspend uranium enrichment-related activities pending further negotiations on trade and diplomatic concessions.
While the deal ultimately foundered on mutual mistrust, it was Rouhani's role in the talks, his establishment background and links to Khamenei that helped propel him to power in 2013.
"Rouhani was the best candidate for the regime. He could work with Khamenei, the Europeans knew him and Iranians wanted a smiling, mild-manner president," said a former senior official, who was involved in high-ranking meetings ahead of the election.
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)
Get Breaking news, live coverage, and Latest News from India and around the world on NDTV.com. Catch all the Live TV action on NDTV 24x7 and NDTV India. Like us on Facebook or follow us on Twitter and Instagram for latest news and live news updates.