The demonstrations that convulsed more than 100 cities and towns in Iran back in December and January have largely subsided, but that doesn’t mean the government in Tehran is out of the woods yet. Iranians remain unhappy and unsettled about their future while a power struggle is gathering force at the top.

A unique and unwieldy regime that splits authority between a clerical supreme leader and directly elected institutions, the Iranian system has always been plagued by factionalism. The recent protests were in part a result of those struggles: opponents of President Hassan Rouhani staged the first demonstrations in the hardline stronghold of Mashhad. Propelled by videos shared through cellphone apps and social media, the demonstrations quickly spread. Slogans escalated from demands for back pay and complaints about water shortages to calls for the downfall of the regime.

The hardliners, in organizing the Mashhad protests, were reacting to Rouhani’s leak of a national budget that gave billions of dollars to unaccountable clerical foundations and to the Revolutionary Guards, Iran’s premier military and security force. Rouhani and his supporters have been trying to whittle down the foundations’ and Guards’ share of the economy and to attract foreign and Iranian private investment. They are also seeking to reduce cash handouts begun during the oil boom years of Mahmoud Ahmadinejad and to resolve massive problems in the banking sector.

The hardliners want to keep their economic fiefdoms. They’re intent on resisting reforms that reflect how much their society has liberalized since the 1979 revolution.

In addition to clashes over policy, the Rouhani and hardline camps are vying to determine the succession to the supreme leader, Ayatollah Ali Khamenei, who is 78 and has suffered from prostate cancer. Khamenei has reigned since 1989 and his death is likely to be a major inflection point for the Islamic Republic. Many analysts believe that Khamenei will not be succeeded by a single individual but by a council—or that the office will be eliminated completely.

Iran has a more than century-old history of aspiring to representative democratic governance, beginning with the first constitutional revolution in the Middle East in 1906. The current system contains the bones of a democracy—an elected president and parliament—and could evolve further in that direction if clerical bodies such as the office of supreme leader and the Guardian Council—which vets candidates for elected office—are scrapped. This would probably require a nationwide referendum, which is permitted by Article 59 of the Islamic Republic’s constitution.

But there is also the possibility that members of the Revolutionary Guards could try to seize power or that the country could erupt in civil strife.

One reason that the regime was able to put down the December-January protests relatively easily was that middle-class Iranians in major cities such as the capital, Tehran, stayed home. Fear of instability and violence was certainly a factor: Iranians see what is happening in Syria, Iraq, Yemen, and Libya, and do not want to risk a similar collapse or invite foreign intervention.

But Iranians are also angry at the system and disappointed that the nuclear deal—Rouhani’s only major accomplishment—has not brought more widespread benefits. Many Iranians blame the Trump administration for casting uncertainty over the nuclear agreement and scaring off foreign investment. A near-unanimous 96 percent in a recent poll want the government to do more about its own corruption and mismanagement.

Iranians and others who attended the annual commemoration of the revolution on February 11 said the mood this year was particularly subdued. Rouhani campaigned on a slogan of “prudence and hope” but hope is in short supply.

Seeking scapegoats, the intelligence branch of the Revolutionary Guards has continued a despicable practice of arresting dual nationals on bogus charges, sometimes with tragic results. Over the weekend, the son of Kavous Seyed-Emami, a renowned environmentalist and a dual Iranian-Canadian citizen, revealed that his father had died in detention, ostensibly a suicide. However, marks on the body indicated torture, according to a well-informed source, and many Iranians inside and outside the country have called for an investigation.

Tehran’s prosecutor, Abbas Jafari-Dolatabadi, has accused Seyed-Emami and a half-dozen other detained environmentalists of a preposterous espionage scheme, asserting that their activism was a cover for monitoring Iran’s missile program. More likely, the case is another reflection of the escalating intra-government power struggle and an effort by hardliners to discredit the Rouhani government’s outreach to the large Iranian diaspora to revive the economy and address Iran’s serious environmental degradation.

At an event at the Atlantic Council on February 12, analysts disagreed about Iran’s political trajectory. Alireza Nader, a former senior analyst for Rand, argued that the Islamic Republic is on its last legs and that only a wholesale upheaval will do. Others—author Nazila Fathi, Brookings expert Suzanne Maloney, and this writer—think the regime will continue to muddle through and warned that a successor government might not necessarily be an improvement.

All agreed that America’s ability to affect Iran’s political future is limited. The best course would be to end the Trump administration’s unjustified restrictions on Iranian travel to the U.S., lift sanctions that impede the export of communications technology and software to Iran, “name and shame” human rights abusers, and continue to implement the nuclear deal.

Much maligned by neoconservatives, the nuclear agreement has actually contributed to Iran’s domestic ferment by removing sanctions as the primary scapegoat for Iran’s many failings. Iranians are now engaged in deep introspection about their form of government and their role in the region and the world. Well-wishers on the outside can hope Iranians find their way to a system more at peace with itself and others. But in the end, that’s for Iranians to decide.

Barbara Slavin is director of the Future of Iran Initiative at the Atlantic Council and the author of Bitter Friends, Bosom Enemies: Iran the U.S. and the Twisted Path to Confrontation.