Iranian President Hassan Rouhani inspects an honor guard during a visit to New Delhi, Feb. 17, 2018. REUTERS/Adnan Abidi

The Iranian president’s signature achievement, a landmark nuclear deal with world powers, is starting to unravel, and his economy is in distress even before renewed U.S. sanctions begin to bite, with Iran’s currency swooning to record lows against the dollar.

His domestic opponents are clamoring for his resignation. One conservative Iranian news outlet even likened him this week to the disgraced former British prime minister Neville Chamberlain for allegedly trying to appease Western powers by trying to salvage the nuclear deal.

But even as he faces the most serious challenge yet to his presidency, Hassan Rouhani has forged ahead with efforts to save the accord and, by extension, his own credibility.

Longtime observers say it is far too early to count Rouhani out. They point to his skills as a shrewd political operator, honed over decades as a government insider, as well as his long-standing ties to Iran’s ruling clerics.

For now, Iran’s pragmatist president continues to enjoy the support of Supreme Leader Ali Khamenei, who wields the ultimate authority in the country. Although hard-line opponents called for Iran to immediately reject the nuclear agreement after President Trump withdrew from it this week, Khamenei publicly endorsed Rouhani’s push for more diplomacy.

Rouhani, first elected in 2013 and now in his second term, ended Iran’s status as a pariah state following the tenure of his predecessor, hard-liner Mahmoud Ahmadinejad. The former firebrand president presided over widespread corruption, the near-collapse of the economy and a harsh crackdown on dissidents.

The mild-mannered Rouhani, a rotund cleric known for his constant smile, put a fresh, moderate face on Iran’s foreign policy. And while Rouhani and Khamenei have sparred openly over matters such as the economy and nuclear talks, the supreme leader is loath to return Iran to the chaos of the Ahmadinejad years, according to Reza Marashi, research director at the National Iranian American Council in Washington.

“Khamenei might be a cunning ideologue, but he’s not suicidal,” said Marashi, who previously served in the State Department’s Office of Iranian Affairs. “He’ll use Rouhani’s political consensus-building skills and his team of technocrats to help stabilize the economy and more competently handle state affairs — especially at a time when Iran is under siege.”

The nuclear agreement — which also was signed by Britain, China, France, Germany, Russia and the European Union — has helped ease Iran’s international isolation, offering major sanctions relief in return for restrictions on Tehran’s atomic energy program. Rouhani had pinned his legacy to the deal.

He said this week that Iran would adhere to the agreement so long as it served the country’s interests, and he directed his diplomats to negotiate with the deal’s other signatories to keep the pact alive. Foreign Minister Mohammad Javad Zarif is scheduled to meet with his British, French and German counterparts in Brussels on Tuesday.

Women cross a street near a giant political mural depicting Ayatollah Ali Khamenei, Iran's supreme leader, left, and Ayatollah Ruhollah Khomeini, founder of the Islamic Republic of Iran, in Tehran, on May 9, 2018. (Ali Mohammadi/Bloomberg News)

“If we conclude that we can achieve everything that we want, the agreement will still apply, and we can continue on the path to international peace,” Rouhani said. But if these talks do not pay dividends, he said, Iran is ready to ramp up its enrichment of uranium. Enriched uranium can be used as fuel for nuclear power plants or — if enriched at a much higher level — as fissile material for nuclear bombs.

It was not clear what conditions his government would seek. But shielding Iran’s economy from embargoes on its oil and banking sectors is a priority.

Marashi said that declarations of Rouhani’s demise have failed to take into account the support among Iran’s political elite for these nuclear negotiations. Senior figures in Iran’s political and security establishments in addition to Khamenei — including the powerful Revolutionary Guard Corps — have stopped short of calling for Iran to immediately leave the agreement.

Emotions are running high. Thousands of people took to the streets in cities around Iran on Friday to protest Trump’s decision to withdraw from the accord. The stakes for Rouhani could not be higher.

“If the deal collapses, then Rouhani is finished,” said Nader Hashemi, director of the Center for Middle East Studies at the University of Denver. “He will become a lame-duck president and slowly pass into oblivion.”

In the short term, Rouhani’s popularity should keep him afloat. As recently as last month, 59 percent of Iranians held a favorable view of the president, according to a survey by the University of Maryland and a market research firm, IranPoll.

But his approval rating, the firm said, also has steadily declined in recent months. And Rouhani must still contend with the myriad crises that have roiled Iran.

Iranians are fed up with joblessness, soaring prices and a depreciating currency. Nationwide protests broke out in the winter over the ailing economy after a leaked government budget proposal showed cuts to subsidies for the poor.

For most Iranians, there has been little sign of the booming trade and investment that Rouhani promised would come from the nuclear accord once sanctions were eased. According to the IranPoll survey, 79 percent of Iranians said in April that they saw no improvement in their living conditions as a result of the deal.

Growing discontent, coupled with the vociferous attacks from rivals, will keep Rouhani on the defensive, analysts say.

“At a minimum, Iran’s president will be forced to spend a significant amount of time and energy rebuffing criticisms from the hard-liners as well as the public,” said Reza H. Akbari, who researches Iranian politics at the Institute for War and Peace Reporting in Washington. The president’s opponents “are going out of their way to argue that the Rouhani administration squandered Iran’s nuclear program and offered excessive concessions.”

In a message posted to its Telegram instant-messaging channel this week, the hard-line media network Ammar Cyber Headquarters called for Rouhani’s “disqualification” from the presidency for making such a strategic blunder.

“Five years wasting time on damaging things like the [nuclear deal], losing our scientific knowledge and industrial power through nuclear energy . . . and failing to gain experience by engaging with the enemy — all so people could live through this disappointment,” the network said.

Rouhani’s allies, meanwhile, are urging him to take measures to shore up public confidence in the government, including reshuffling his cabinet and speaking more frankly with Iranians about the challenges ahead.

“He should stop making promises,” Mostafa Hashemitaba, a pro-reform politician and former presidential candidate, said in a radio interview, “and start talking to people about real problems.”

Esfandyar Batmanghelidj, founder of the Bourse & Bazaar website featuring economic analysis on Iran, said Rouhani is under “great pressure to retaliate” by pulling out of the accord, thus proving that Iran cannot be bullied.

“This pressure is coming not just from hard-liners, but from the general public as well,” he wrote this week in a column on the site. “If the Rouhani administration can credibly demonstrate to the public that there is a plan for principled defiance . . . it remains possible for Iran to remain in the deal.”

Bijan Sabbagh contributed to this report.