ISTANBUL — A fictional series that aired recently on Iranian television portrayed the country's Foreign Ministry as infected by Western spies bent on stealing information about nuclear talks with the United States and other world powers. Another show, a documentary, suggested that hapless Iranian nuclear negotiators were strolling into a trap laid by the United States.

“America plans to lift sanctions only on paper and force Iran to reduce nuclear activity in return for nothing,” a narrator says in the documentary, called the “The End of the Game,” which, like the series, aired on a state-run channel controlled by Iranian hard-liners.

In a bruising debate unfolding on television, in the media and within parliament, Iran’s competing political factions in recent weeks have wielded the nuclear talks like a cudgel. Hard-liners wary of engagement with the West have landed the harshest blows, leveraging their control of Iran’s airwaves to discredit President Hassan Rouhani’s government and the more moderate wing of Iranian politics it represents.

Analysts say the intensifying attacks by hard-liners could complicate, but not derail, negotiations currently underway in Vienna to revive the 2015 nuclear deal. But more critically, the offensive is a part of the politicking before Iran’s presidential election in June, starring a slate of candidates yet to be cast in a poll with potentially significant consequences for the United States.

The attacks — a reflection of Iran’s energetically contested politics — have sharpened old battle lines between hard-liners and so-called pragmatists. But arguments are being waged more vigorously now as elections approach at the same time that signs of progress are emerging from negotiations over the nuclear accord, formally known as the Joint Comprehensive Plan of Action.

“It’s very clear there is an organized onslaught by opponents of the JCPOA in Iran, against reviving the deal under the Rouhani administration,” said Ali Vaez, Iran project director at the International Crisis Group.

The “uptick” in attacks was being driven by fear, he said. As the Vienna talks progress, hard-liners are “becoming more concerned by the electoral implications,” including the possibility that successful negotiations could embolden a candidate associated with the moderate camp, such as Foreign Minister Mohammad Javad Zarif, to enter the presidential race. Rouhani, who has served two terms, is prohibited from running again.

Under President Donald Trump, the United States withdrew in 2018 from the nuclear deal, which promised Iran relief from sanctions in return for limits on its nuclear program. Trump reimposed the U.S. sanctions and imposed hundreds of new ones. Iran, in response, began breaching the terms of the accord, including uranium enrichment beyond agreed limits.

As the Biden administration and the Rouhani government seek to revive the deal, they have both faced intense domestic opposition. Skeptics in the United States have called for a more robust accord that addresses Iran’s military activities beyond its borders as well as its ballistic missile program.

In Iran, the Trump “maximum pressure” campaign has left behind an economy battered by sanctions, wariness of U.S. promises, and hard-liners in many ways ascendant.

Leaked audio of an interview with Zarif that surfaced late last month was the latest reminder of the intensity of Iran’s rivalries. In it, he complained about the ways Iran’s security services have sought to undermine the diplomatic corps and the nuclear talks. In the audio, which was recorded in March, he also suggested he would not run in the election.

It was not clear who leaked the audio, or why. Rouhani, during a cabinet meeting on Wednesday, called on the Ministry of Intelligence to investigate the leak. “At a time when Vienna is at its peak of success, this tape is being published to create discord within,” he said.

Since its first season in 2019, the television series, called “Gando,” has drawn a sharp line between competing factions in Iran’s leadership and landed firmly on the side of the hard-line security establishment. In the show, agents from Iran’s Revolutionary Guard Corps root out corruption and treachery in a government that closely resembles Rouhani’s.

In the opening season, Iranian intelligence pursued a spy who bore a close resemblance to Jason Rezaian, a Washington Post reporter who spent 18 months in an Iranian prison on bogus espionage charges before he was released as part of a prisoner exchange in 2016.

The latest season began airing in late March and continues its depiction of Iran’s intelligence operatives as resourceful, dashing and humane. It begins with a dramatization of the real-life kidnapping of Ruhollah Zam, a dissident journalist who was abducted by Iranian agents from Iraq and executed in December in Iran.

One character in the show, a dimwitted member of the Iranian negotiating team, has a name that sounds suspiciously like that of Deputy Foreign Minister Abbas Araghchi, Iran’s real-life lead negotiator in the nuclear talks. The character falls for a British ruse and leaks information about Iran’s plans for the nuclear negotiations.

The documentary, “The End of the Game,” focuses in large part on Robert Malley, the former head of the International Crisis Group who now serves as the Biden administration’s special envoy for Iran. Referring to him as “the shadow man,” the show notes that his parents are Jewish and, over an ominous soundtrack, refers to Malley’s past meetings with Zarif as if they were a revelation. In fact, it is no surprise that Malley, who was the Obama administration’s lead negotiator for the original nuclear deal, had previously interacted with Zarif.

“A lot of these arguments are not new. It’s a rehash of conspiracy theories put out in 2015 and 2016,” Vaez said, referring to the period when the original nuclear deal was signed. “What’s interesting for me is that the government is fighting back more publicly,” he said, citing instances in which Foreign Ministry officials had pushed back against press reports that painted the negotiations in an unfavorable light.

“It indicates that the Rouhani administration has nothing to lose and it’s willing to take bigger risks to make sure its legacy is more than a half-dead nuclear agreement and an economy that’s in dire straits,” he said.

Zarif and other officials in the moderate camp have also engaged in “very open” conversations on Clubhouse, the online discussion app, to make their case directly to the public, according to Sanam Vakil, deputy director of the Middle East and North Africa program at Chatham House. On the other side, conservatives have been using “all possible tools,” including Iran’s airwaves, to argue they were the better stewards of Iranian policy.

“I am not really clear what their policies are yet,” Vakil said of the conservatives. “We know they are very clearly trying to discredit Rouhani and Zarif. What are they promoting? Are they putting themselves out there as alternate negotiators, or better negotiators?”

Both camps were competing for an electorate that was “checked out — focusing on their own private and local issues,” as Iran copes with economic problems and a devastating coronavirus outbreak.

Lower turnouts have favored conservatives in the past. In parliamentary elections last year, which occurred in the “doom and gloom” of Trump’s maximum pressure campaign, low participation delivered a landslide for hard-liners, Vaez said.

Denigrating the nuclear deal or delaying its restoration could also serve the hard-liners, he said. If the fate of the deal remains uncertain during the campaign, this could engender voter apathy. But if an agreement is concluded after the election, a conservative president would still stand to reap the benefits, including the lifting of sanctions.

“That works beautifully for the deep state,” he said, referring to the hard-line factions. “That’s why they try to create impediments. So the disagreements are not swiftly resolved.”