Tehran: Iran's president has been pursuing a nuclear agreement for two years but even if a deal is reached Hassan Rouhani and his government will soon face mounting political pressure at home.
Having sought to end the nuclear crisis - and with it the international sanctions that have paralysed Iran's economy - Rouhani's fate is often seen as inextricably linked to the negotiations.
An agreement with world powers, due by a today deadline widely expected to be extended by a few days, could define his presidency.
But despite the risks he has taken in pushing for a deal against hardline opposition, just reaching one may not be enough to ensure Rouhani's political future, analysts say.
Instead, long-term success is likely to hinge on whether he can ring the changes at home after making pre-election pledges on social and cultural reforms that have taken a back seat to the nuclear talks.
In parliamentary elections next February voters could endorse Rouhani, a moderate, by backing candidates who favour his bid to bring Iran out of the international deep freeze.
But they could also reject his outreach and vote for conservatives, including hardliners, who - deal or no deal - will assert that Rouhani has not delivered on his promises.
The stakes are high, said Amir Mohebbian, a conservative-leaning analyst with close ties to Iran's leadership, and Iranians are looking for tangible results.
"To the people, the situation has not changed and many think the negotiations are a game in which they have gained no advantages. This perception feeds the opponents of a deal," he said.
Economy Still Struggling
"The only thing that gives Rouhani support is hope, but for him to keep saying 'We are optimistic' becomes harder to reconcile in the minds of the Iranian people the longer this goes on.
"If expectations are not realised it could become very easy for his enemies to say: 'You achieved nothing'."
Iranians are continuing to suffer from sanctions imposed on the country's banks, oil industry and other parts of the economy because of the nuclear programme.
Inflation - 42 per cent before Rouhani was elected - has eroded people's savings.
Despite managing to slash the rate to 15 per cent and move the economy from recession into growth, the collapse in global oil prices has hit the government's finances hard.
An austerity budget in March has been followed by cuts to state subsidies, long seen as an unaffordable legacy of the petrodollar profligacy of Rouhani's predecessor, Mahmoud Ahmadinejad.
But even if sanctions are lifted the effects won't be immediate.
"It will not be OK overnight because the political-economic situation is very bad," said Saeed Laylaz, an economist in Tehran, noting that the elections will force the president to confront more sensitive issues.
"Rouhani has many headaches. Socially and culturally there will be a big challenge. He has managed to delay this until now because of the nuclear talks, but he may soon lose that excuse."
2016 Vote Will be Key
Recent ventures by Rouhani's government into domestic politics have been without much success.
After a minister said women would be allowed to attend a male volleyball match in mid-June despite a ban, security officials barred them.
And earlier this year Rouhani came under attack from clerics after speeches in which he said police should enforce the law rather than attempt to teach Islam. The remarks were seen as a warning to Iran's security forces that they should not exceed their powers.
Such calls from Rouhani are likely geared to winning approval from advocates of reform in the Islamic republic.
"He is trying to say 'I did not forget my promises'" said Laylaz. "A nuclear deal would make Mr Rouhani stronger and he would try and use that strength. A deal makes him more attractive to reformists."
After years in the political wilderness following deadly street protests after the disputed 2009 presidential election, two new reformist parties were recently approved by the regime.
If their candidates attract votes, they could oust conservative opponents of Rouhani's policies and potentially work with the president on legislation that fits his moderate agenda.
But demands from reformists for swift change could re-expose the president to political pressure from regime members resistant to such moves.
Of course there is no guarantee of a deal and if it falls apart the pressure on Rouhani will be even stronger, said Davoud Hermidas Bavand, a veteran analyst at Tehran University.
"Having expended so much energy on the negotiations the only option for Rouhani may be to resign."