Iranian President Hassan Rouhani sits next to Hassan Khomeini, the grandson of the Islamic Republic’s founder Ayatollah Ruhollah Khomeini, during a ceremony commemorating the death of Ruhollah Khomeini's son, in Tehran on October 23, 2017. (Handout/Reuters)

Escalating tensions with the United States have stirred nationalist sentiment in Iran, giving its hard-liners an opportunity to more fiercely target critics and settle old scores, rights advocates and analysts say.

The clampdown on activists, journalists and even politicians has served as a warning to pro-reform leaders who have pushed for a more tolerant and open Iran.

In recent weeks, hard-line judges have confined a reformist ex-president to his home, sentenced pro-reform leaders to prison and opened a criminal investigation into BBC’s Persian-language channel for conspiracy to harm national security.

They also placed travel restrictions on the family of late president Ali Akbar Hashemi Rafsanjani, another reformer, and on Wednesday an appeals court upheld a sentence for a pro-reform activist on national security charges.

The rivalries predate the current turmoil with the United States. But the moves also come as hostilities between the two countries have reached a fever pitch. Last month, President Trump announced a new strategy to combat Iran, blasting its government as a “fanatical regime” that has “spread death, destruction and chaos all around the globe.”

Supreme Leader Ayatollah Ali Khamenei said in a televised speech Nov. 2 that Iran won’t stop developing defense capabilities. (Reuters)

Trump also refused to certify Iran’s compliance with a nuclear deal it signed with world powers in 2015, threatening a landmark accord that curbed Iranian nuclear activities in exchange for the lifting of sanctions.

“Trump’s Iran policy makes it much easier for Iranian hard-liners to put the country on a war footing, crack down on civil society and invoke Iranian nationalism as a rallying cry,” said Nader Hashemi, director of the Center for Middle East Studies at the University of Denver.

Hard-liners in the judiciary and security and religious establishments “have been saying to the Iranian public: ‘See, we told you so’ ” about the hardening of U.S. policy, he said.

And that has given them space to “suffocate the reformists,” said Omid Memarian, deputy director of the New York-based Center for Human Rights in Iran.

But while Iran’s reformists have suffered far worse, the timing of the most recent moves has stoked particular concern.

Trump’s rhetoric may have offered an opening in which to ramp up pressure. But the convictions, arrests and other restrictions also follow the May reelection of moderate President Hassan Rouhani, a reformist ally who harshly condemned hard-liners’ more authoritarian tendencies during the campaign.

For years, the divide between hard-liners and reformists has colored — and fractured — Iranian politics, beginning with former president Mohammad Khatami’s efforts in the 1990s to nudge the system toward reform. Khatami, who remains popular, is barred by authorities from speaking to or appearing in the media. Last month, security forces prevented him from leaving his home, according to local media reports, effectively putting him under house arrest.

Khatami’s vision for a less rigid and more tolerant Islamic Republic, established in 1979, prompted Iran’s powerful Revolutionary Guard — then just a paramilitary organization — to enter politics and back Iranian conservatives.

The enmity between the two sides came to a head in 2009, when reformists challenged the disputed results of that year’s presidential election. Mass demonstrations alarmed the regime, which responded with a brutal crackdown and sweeping arrests. The reform movement appeared all but decimated, and hopes for a comeback were dim.

But Rouhani’s presidency, coupled with recent victories for reformists in parliamentary and municipal elections, have again amplified pro-reform voices, much to the hard-liners’ chagrin.

The most recent moves probably “were initiated to blunt any prospect for a reformist revival,” said Suzanne Maloney, an expert on Iran at the Brookings Institution, adding that “the surge of chauvinism provoked by Trump’s speech gave [Supreme Leader] Khamenei some additional room for maneuver.”

In an article published late last month, a news outlet linked with the Revolutionary Guard called the ongoing investigation into BBC Persian, including the seizure of local journalists’ assets, part of the “spoils of war” in Iran’s conflict with the West.

The ability of the United States to greatly affect Iran’s domestic politics is still limited, and reformists, too, will unite with conservatives to oppose any outside aggression. But even beyond the recent crackdown, analysts have pointed to noticeable shifts.

In his Oct. 13 speech, Trump said he would sanction Iran’s Revolutionary Guard, more aggressively target its missile program and work with regional allies to counter its support for proxies.

“Hard-liners in both the U.S. and Iran have a mutually reinforcing effect on each other” because they tend to bolster the other side’s worldview, Hashemi said.

“After Trump was elected, Khamenei gave a speech blasting liberal democracy for producing such an electoral outcome, telling Iranian youth that their fascination with the West was misplaced,” he said.

And while Rouhani was the reformists’ main hope for progress, he remains a pragmatist and has tempered some of his own criticism of hard-line institutions like the Revolutionary Guard.

Since starting his second term, Rouhani, who pinned his presidency on the success of the nuclear deal, has worked to “keep himself in the conservative camp in case something unexpected happens” with the United States, Memarian said.

“He might think that he wouldn’t survive if the nuclear deal collapsed and he was fighting with hard-liners over domestic issues at the same time,” he said.