Iranian President Hassan Rouhani walks past a picture of Supreme Leader Ayatollah Ali Khamenei. Rouhani has pushed back against a crackdown by Khamenei and other hard-liners. (Ebrahim Noroozi/AP)

A prominent Iranian recently blasted the symbiotic relationship between state media and security forces, saying he can tell by reading the critical stories who is about to be arrested.

That disgruntled Iranian was not some activist for press freedom but Iran’s president, Hassan Rouhani.

His unusual critique in a speech broadcast on state television last weekend demonstrates how much conflict within the Iranian government has spilled into the open in the wake of the country’s nuclear deal with the United States and five other world powers. Rouhani, a pragmatist, has repeatedly pushed back against a crackdown underway from isolationist hard-liners who control the judiciary and intelligence branches and who are working to undermine the nuclear deal.

The hard-liners are signaling that Rouhani’s attempts to reestablish Iran’s place in the world can go only so far. Whichever side prevails in parliamentary elections scheduled for late February could determine the path Iran will take for years to come.

For now, the crackdown will shadow Rouhani as he visits Italy and France this weekend to drum up trade deals. He is likely to face questions about the arrests of many journalists, activists, intellectuals, dual citizens of Iran and the United States, and even poets accused of “undermining” the Islamic republic.

Many analysts say the flood of arrests was an inevitable consequence of the July agreement, in which Iran agreed to limit its nuclear capacity in exchange for relief from sanctions. Iran’s supreme leader, Ayatollah Ali Khamenei, backed the negotiations, but since the deal, he has repeatedly warned against “infiltrators” from the United States and Europe. The crackdown is one way to block any warming of relations between Iran and the United States, a country the hard-liners still call the Great Satan.

“Ayatollah Khamenei wanted the agreement, but he didn’t want an opening,” said Ray Takeyh, a fellow in Middle East studies at the Council on Foreign Relations. “He was concerned about the cultural infiltration that accompanies any potential opening. One way to protect the system and ideology would be to have a crackdown.”

For many Iranians, the nuclear deal was never just about centrifuges and uranium stockpiles, which under the agreement will be reduced and monitored to prevent Tehran from getting enough material to build a nuclear weapon. It wasn’t even about lifting the yoke of sanctions. The negotiations were more about what kind of country Iran will be — isolated and pure, with a “resistance economy,” or more open to outside goods and the inevitable cultural changes they will bring.

“For Iran’s deep state, the nuclear deal was merely a tactical, temporary compromise, not a strategic reorientation,” said Karim Sadjadpour, a policy analyst with the Carnegie Endowment for International Peace. “Khamenei has seemingly given a carte blanche to Iran’s repressive apparatus to aggressively counter any political, social and economic change agents.”

On Sept. 16, two months after the deal was finalized, Khamenei gave a speech to commanders of the Revolutionary Guard Corps in which he urged their intelligence organization to counter an “infiltration plot” concocted by Washington.

“Economic and security infiltration is obviously dangerous and can have serious consequences, but political and cultural infiltration by the enemy is a much more dangerous issue,” he said.

His remarks effectively were a thumbs-up to the Revolutionary Guard and the judiciary to steam ahead, weakening Rouhani and squashing anyone who might be an agent of reform — moderate journalists or Iranian American businessmen who could serve as intermediaries, for example, as well as Rouhani and his foreign minister, Mohammad Javad Zarif, who negotiated the deal.

“Conservatives and the IRGC forces who were not happy with the nuclear deal were waiting for an opportunity to go beyond just criticizing the deal, to embarrass Rouhani and Zarif and undermine the president,” said Haleh Esfandiari, a scholar with the Woodrow Wilson International Center for Scholars.

Within days of Khamenei’s speech, a dozen members of parliament wrote a letter to the Ministries of Intelligence and of Culture and Islamic Guidance warning that Iran had been infiltrated by reformist media and “hundreds” of Western spies.

The security and judicial forces have been operating at a clipped pace ever since.

In mid-October, Iran’s judiciary announced that a guilty verdict had been reached in the purported espionage case of imprisoned Washington Post correspondent Jason Rezaian, who has been detained since July 2014 and was tried in closed-door court. His family and senior editors at The Post have asserted that Rezaian is innocent and called the secret proceedings a “sham” trial. On Friday, Rezaian’s brother Ali released a statement urging European leaders who meet with Rouhani to advocate for the Post reporter’s release from prison.

Shortly after Rezaian’s conviction, security agents arrested Iranian American businessman Siamak Namazi, a consultant based in Dubai who makes frequent trips to Iran. They also detained Nizar Ahmad Zakka, a Lebanese information-technology specialist who is a permanent resident in the United States.

In early November, the commander of the Revolutionary Guard called the period after the nuclear deal a “fourth sedition,” following in the footsteps of the “seditions” that prompted crackdowns after the Iran-Iraq War, student uprisings in 1999 and post-election protests in 2009.

In recent weeks, at least five Iranian journalists have been taken into custody, all of them representing what are considered reformist-oriented news or social-media outlets. According to Hadi Ghaemi, head of the New York-based International Campaign for Human Rights in Iran, many other Iranian journalists have been harassed and threatened by security agents.

Crackdowns have taken place in Iran before, most recently ahead of the 2012 elections, which ushered in a hard-line parliament that has impeded Rouhani’s ability to get more moderate legislation passed.

“They’re sending the same message” as in previous crackdowns, said Suzanne Maloney, deputy director of the foreign policy program at the Brookings Institution. “The Islamic republic isn’t going anywhere. The ideology won’t be modulated by this particular diplomatic agreement, and anyone who dabbles in building bridges — to the United States in particular — is at risk.”

The parliamentary elections on Feb. 26 will be particularly crucial, at least if reformist contenders are not disqualified by the Guardian Council, which vets candidates. Not only will the elections demonstrate how Iranians feel about the openings stemming from the nuclear deal, they will also determine who sits on the Assembly of Experts. That is the panel that could be called on to pick a successor to the 76-year-old Khamenei, who reportedly underwent an operation for prostate cancer last year.

That helps explain why Rouhani made a pitch for press freedom in his Nov. 8 speech, calling for media regulations that would shield journalists from a crackdown. “Transparent regulations will stop certain people picking up on a word or a sentence in a media outlet and putting their freedom at risk,” he said.

And in a video he posted on his Instagram page Nov. 4, Rouhani suggested that the crackdown was related to the upcoming elections.

“We should not senselessly go after one person or two people and take them from here or there, and say this is linked to infiltration and make this a big case in the country,” he said.

He also pushed back on how the word “infiltration” is frequently aimed at political opponents. “We have to fight in a serious and real way any type of foreign infiltration, and a few should not toy with the word,” he said.

Ghaemi said it is too soon to tell whether Rouhani’s back talk represents a turning point.

“But after the deal, with the approaching February election, he wants to make sure the environment doesn’t close down completely, and he’s helpless in having mass communication channels,” he said. “Rouhani can’t work with this parliament. It’s gridlock.”

Read more:

13 charts and maps that make the Iran deal a little easier to understand

Historic deal reached with Iran to limit nuclear program

A timeline of the Jason Rezaian case

Full coverage on Post correspondent Jason Rezaian