(CNN) He may be the ultimate insider, but Hassan Rouhani is running like the anti-establishment candidate.

At a campaign rally last week at the Azadi stadium in Tehran, Rouhani took to the stage and delivered a speech more worthy of an outsider than the incumbent President of Iran.

Standing behind a lectern and surveying the sea of purple -- his campaign color -- before him, Rouhani promised much.

"We want freedom of the press," he declared, "freedom of association, and freedom of thought!"

As he spoke, more than 10,000 supporters -- many of them women, many of them middle class -- chanted slogans demanding the release from house arrest of leading opposition figures.

Iranians head to the polls for presidential elections on Friday, and the man who promised and delivered the country's nuclear deal with the international community is up against a hardline cleric in a contest that many analysts describe as too close to call.

For Rouhani, the choice is simple: "Our nation will announce if it continues on the path of peacefulness or if it wants to choose tension."

Rouhani supporters wave his portrait and chant slogans at a rally in Tehran.

He has been here before. In the 2013 campaign, Rouhani talked up liberalization and won by the slimmest of margins. This time he's using the same playbook in the face of a growing conservative challenge.

Suzanne Maloney, a long-time observer of Iran at the Brookings Institution, says the message may be similar but the circumstances are not. In 2013, Iranians were desperate for change and an end to sanctions. Rouhani came through a crowded field in a late surge. This time, she says, Rouhani has one serious opponent: the conservative cleric Ebrahim Raisi.

Often mentioned as a possible successor to Ayatollah Ali Khamenei as Supreme Leader, Raisi appears to have the backing of the clerical establishment.

Nuclear dividends

At the heart of the campaign is a simple question: has the nuclear deal struck in 2015 -- and the resultant relaxation of international sanctions -- improved the lives of Iranians?

Rouhani saw relief from sanctions as essential to liberating the country's economy. Up to a point it has worked. The Iranian economy grew by about 7% last year, according to the International Monetary Fund. But most growth came from a post-sanctions revival of oil exports; non-oil growth was less than 1%.

Unemployment is still stubbornly high. Official figures show that in 2015, 31% of men and 53% of women aged 18-29 were unemployed. Many of them, whether they be married or not, still live with their parents because of a shortage of affordable housing.

Ebrahim Raisi stands among his supporters during an April campaign rally in Tehran.

Raisi accuses Rouhani of sacrificing Iran's sovereignty for a fool's bargain. Other conservative critics say Rouhani has looked after the interests of the ashraf, or elite, at the expense of the mostazafin, the oppressed.

Alireza Nader, a senior analyst with the RAND Corporation, says it's true that most Iranians are yet to see the benefits of the deal. Nor has Rouhani fulfilled his promise in 2013 to secure the release of political prisoners, Nader says, including opposition leaders under house arrest.

Ahmad Majidyar, who leads the IranObserved Project at the Middle East Institute, agrees that "many reformists are dismayed by the President's unwillingness to stand up to the country's judiciary and security establishment."

While the reformists won't vote for Raisi, many may not bother to vote at all. And in a tight contest, given the conservatives' renowned ability to get out their vote, that might be enough to give Raisi victory.

Rouhani has asked for patience and promised to work towards eliminating the onerous sanctions that are still in place. But to motivate his base, he has focused on Raisi's record of stifling dissent and the killing of political opponents. As a judge in 1988, Raisi approved the execution of thousands of leftists.

"Those of you who cut out tongues and sewed mouths shut ... who banned the pen and the picture, please don't even breathe the word freedom," Rouhani told one rally.

"Please don't abuse religion for power," Rouhani told Raisi to his face at the final televised debate.

It might sound like the Islamic Republic is coming apart at the seams. But Alireza Nader at the RAND Corporation thinks that although Rouhani's campaign rhetoric is designed to make him sound tough and determined, his ability and desire to translate words into deeds will be limited should he be re-elected.

Rouhani is good at co-opting the message of greater social and political freedom on the campaign trail, according to Suzanne Maloney at Brookings. But he has previously invested little political capital in opposing censorship or advancing women's rights, for example.

In no small part this is because Rouhani knows the limits of his power in a system where the President must contend with other centers of gravity -- notably the authority wielded by Supreme Leader Khamenei, and by institutions such as the Revolutionary Guards.

Rouhani (L) and Raisi (R) take their seats for a televised debate in late April.

Rouhani admitted as much at his Tehran rally. "I often had problems keeping my promises," he told the crowd. "What I promised in 2013, either I did or wasn't allowed to do."

Farzan Sabet at Stanford University's International Center for Security and Cooperation says Rouhani will need a new, stronger mandate if he is to "make a better case for changing direction on key issues, such as social and political freedoms."

But don't expect open confrontation. There is a tacit understanding between Rouhani and Khamenei. As a young man back home from studying in Scotland, Rouhani connected with Khamenei in the early days of the Islamic Revolution, during the war against Iraq. In 2003, he became Khamenei's troubleshooter on the nuclear program.

Rouhani must contend with other centers of gravity -- namely Iran's Supreme Leader Ayatollah Ali Khamenei.

Ahmad Majidyar at the Middle East Institute says that "despite some policy differences with Khamenei in the past four years, Rouhani has maintained a good working relationship with him and has not openly challenged the Supreme Leader's authority."

For his part, Khamenei did not stand in the way of the 2015 nuclear agreement. But his support has never been more than tepid. He said this month that "some say since they [i.e. Rouhani] took office, the shadow of war has faded. This is not correct."

Time is the enemy

Other reformist figures have lined up behind Rouhani, including former President Mohammed Khatami, who is still popular among more liberal Iranians. Urging patience, he released a statement Sunday saying: "We started on a path with Rouhani and are in the middle of the journey."

But the journey is proving slow and hard, not least because Rouhani has little control over foreign policy.

"Iran's regional role -- particularly in the conflicts zones of Syria, Iran, Afghanistan and beyond -- is designed and implemented by the Revolutionary Guards under the supervision of the Supreme Leader," says Majidyar at the Middle East Institute. That pretty much rules out any rapprochement with the United States.

Iran's regional policies, its alleged support for terrorism and its missile program will constrict Rouhani's ability to get the remaining sanctions lifted.

JUST WATCHED The Trump effect on Iran's election Replay More Videos ... MUST WATCH The Trump effect on Iran's election 02:11

Sabet says that changing policies in these areas "would require a new consensus-building process between the President and conservative power centers, which would be significantly more difficult than the process that allowed for the nuclear deal."

These sanctions, "coupled with the Trump administration's tougher approach toward Tehran, have discouraged foreign companies and major banks from investing," says Majidyar.

Big oil firms like Total are hedging on billion-dollar investments; banks that have business in the US (which is most) shy away from financing deals. But such investment is critical if Rouhani is to pump-prime the economy.

He has spent a lot of time working on alternatives to western investment, such as a closer relationship with Russia. And Maloney says that if re-elected, Rouhani may try to lure European and Asian investment in the face of a US administration intent on putting greater pressure on Iran. But his room for maneuver will remain limited.

Many of Rouhani's supporters realize he is not intent on some sort of 'Tehran Spring.' But Maloney says they do see him as the best hope for a more open economy, which in turn will bring political and social change.

Farzan Sabet at Stanford puts it another way: "The question many of these voters face is not so much 'Are you better off than you were four years ago?' as it is 'How much worse will life become with the alternative?"