The shaded alleys of the Grand Bazaar in Tehran are awash with crowds, though to the chagrin of shopkeepers most people just wander by. Sanctions have reduced purchasing power, as did the mismanagement of the Ahmadinejad era –inflation rose to 45% in mid-2013. Now under Hassan Rouhani, elected president two years ago, inflation is down to 15%, and the economy is expected to grow this year by about 1%. If sanctions are lifted, Iran’s central bank expects a surge of an extra 2%.

Yet one commodity pulses in abundance through the bazaar’s maze of corridors: hope. It spurts up in conversation whoever you turn to. “We wish, we dream for sanctions to be lifted. We had eight bad years under Ahmadinejad. Sanctions were caused by his denial of the Holocaust,” said Ali, an elderly jeweller. “Under Rouhani the economy has already improved. The value of the rial is rising. Inflation is less.”

Darius sells women’s clothes, and a decade ago he was not allowed to display bras, even on the plastic torsos of legless, faceless mannequins. That is now possible, a small sign of gradual liberalisation, but he too complains that “in the eight years of Ahmadinejad the economy got worse year by year. After the nuclear negotiations we hope it will be better.”

In affluent north Tehran the evidence of recession takes a different form. High-rise blocks of flats stand half-complete, windowless skeletons abandoned when banks foreclosed on loans. But here too, hope is sprouting. In chic garden cafes outside the Film Museum the glitterati enjoy their lattes in the spring sunshine. These are Iranians who already travel regularly abroad and have no major economic worries in spite of sanctions, but their universal wish is that, as soon as a nuclear deal is reached, the country’s re-engagement with the world will put an end to what they regard as the Iranophobia and demonisation from which they all suffer.

The nearby cinema is almost full for an afternoon showing of Tales, the most recent drama film by Rakhshan Bani-Etemad, Iran’s leading female director. Known for her depictions of the struggles of lower-middle-class and poor Iranians, with stories of domestic abuse, drug addiction, unemployment and divorce, Tales touches deftly on mainstream politics. Without mentioning the 2009 street protests that were violently put down after Ahmadinejad’s re-election, a mother seeks in vain bail money to release her son arrested in the street “for nothing but calling for his rights”. Another tale shows an official in a welfare department chatting up his mistress on the phone while ignoring the desperate clients in front of him.

Darius sells women’s clothes, and a decade ago he was not allowed to display bras, even on legless, faceless mannequins

Foreign cinema-goers have become acquainted in the past two decades with the subtlety and sophistication of Iranian films, yet the image of Iran abroad is still absurdly grey and two-dimensional. The country’s confidence and social awareness are rarely put in context. Nor do outsiders realise that Iranians will give their views on their country’s politics to foreigners, including journalists, with less self-censorship than in many places in the region.

Along with hope, the other new factor to emerge since I was last here seven years ago is relief over the country’s stability. Even among those Iranians who shared their negative views with me about the Islamic revolution, there is a pride that Iran has retained its sovereignty and independence. Across the Persian Gulf they see states they regard as American vassals. Now they see something else as well: barbaric fundamentalism running rampant through Iraq; civil war in Syria, Libya and Yemen; and repression in Egypt that exceeds the human rights restrictions Iranians face at home.

As Islamic State spreads its tentacles through Iraq and Syria, it is not surprising that many Iranians say they feel grateful for their own political and social peace. Among Iran’s thinktanks and policymakers support for stability is promoted as a basic principle of Iran’s foreign relations. After his recent meeting with Gulf Arab leaders at Camp David, Barack Obama again denounced Iran’s “destabilising activities” in the region. Iranian officials see this as upside-down thinking. In Iraq, they insist, Iran is a force for stability, helping Haider al-Abadi’s government militarily while urging it to be more attentive to Sunni concerns – just as Washington is.

In the Iranian elite there is debate over how far to go in aiding Abadi and how to deal with the suspicions that Iraqi Sunnis have of Iranian policy in their country; but all sides in Tehran believe that the rise of Islamic State is not just a foreign policy issue, as it is for the west, but a national security threat to Iran. They claim their involvement in Iraq is not motivated, as foreign critics insist, by plans to increase their influence regionally, but to confront a mortal danger to themselves. “Iran’s priority is to strengthen the government in Baghdad by getting more buy-in from Sunni tribes and the Kurds. But Iran has to be sensitive about the domestic effects in Iraqi politics of Iran’s role,” said Kayhan Barzegar, the director of Iran’s Institute for Middle East Strategic Studies.

Some officials even say Saudi actions in Yemen are a 'new Nakba' and worse than anything done by Israel to Palestinians

On Syria too Iranian decision-makers argue that their policy is not, as foreign critics claim, to meddle in the region, but to defend a multicultural state against attack from Islamic nihilists. That does not mean unquestioning support for Bashar al-Assad but for negotiations to produce a coalition government that includes the moderate Sunni opposition and would run the country until a new constitution is agreed and elections are held. If this sounds like the plan put forward three years ago by Kofi Annan, there is one change. Assad would remain in an executive role that would be defined during negotiations. As Hossein Amir-Abdollahian, the deputy foreign minister for Arab and African Affairs, put it to me: “We don’t support the idea of Assad being a president for life. But any political solution should be decided by the Syrian people and their decision respected.”

On Yemen the Iranian media are giving blanket coverage to the Saudi air strikes and the civilian casualties they cause. Officials see the Saudi intervention as a strategic mistake and an own goal in PR terms. Iran, they argue, has not invaded any of its neighbours for centuries yet it is described by the Gulf Arab states as expansionist when the country which is really destabilising the region is Saudi Arabia. Some officials even say Saudi actions in Yemen are a “new Nakba” and worse than anything done by Israel to Palestinians. Yet they continue to call for detente with Riyadh. “We welcome dialogue with Saudi Arabia and are trying to help Saudi Arabia get out of the crisis in Yemen. We welcome regional co-operation,” Amir-Abdollahian said.

His remark is a reminder that managing relations with the west is not the only challenge Iran faces. Success in the nuclear talks would bring a historic compromise with the US after almost 40 years of tension. But if Gulf Arabs condemn Obama’s new policy as a US “pivot” to Shia Iran, the eagerly awaited decline in western hostility may be undermined by a surge in Iranophobia among Sunnis much closer to home.