TEHRAN — Iranian officials, responding to President Trump’s call to revise the nuclear agreement, said they would reject any changes to the 2015 deal, saying it was “not renegotiable.”

Iran’s foreign minister, Mohammad Javad Zarif, wrote on Saturday in a message on Twitter that the nuclear agreement between Iran, the United States and other world powers was “a solid multilateral agreement” that President Trump was “maliciously violating.”

Mr. Trump on Friday, once again, reluctantly signed waivers crucial to keep the agreement in place, but he also demanded that European allies agree to rewrite the nuclear deal within 120 days or else he would kill it.

Mr. Trump also announced new sanctions, including against the chief of Iran’s hard-line dominated judiciary, Ayatollah Sadegh Amoli-Larijani, for his involvement in punishing protesters who participated in anti-government rallies earlier this month.

A series of demonstrations over the economy, which also turned against Iran’s Islamic establishment, erupted in nearly 80 cities nationwide the first week of the year, spreading very quickly, with several turning violent. At least 21 people are believed to have died during the protests, and nearly 4,000 people were arrested.

Two of those arrested died in prison in the aftermath of the protests, in what officials said were suicides. Protesters say the two men were killed.

Mr. Amoli-Larijani is the highest judicial authority in the country. His brother, Ali Larijani, is the speaker of the Parliament.

Iran’s Foreign Ministry said Saturday that the Trump administration had “crossed a red line of international behavior” by imposing sanctions against Mr. Amoli-Larijani. The ministry said that the decision went against international law and that the action would receive a “serious response” from Iran.

Mr. Trump’s ultimatum comes at a time when Iran’s economy is struggling, and the nuclear deal has not delivered on the promises made by Iran’s president, Hassan Rouhani, for economic improvement.

“Naturally, officials are nervous over what the impact would be if Trump withdraws from the deal,” said Nader Karimi Joni, a reformist journalist. “They fear the local currency could devaluate even further and prices could rise, if that is to happen.”

The agreement Mr. Trump wants to make with the Europeans should also involve Iran’s long-range missile program, the White House said on Friday. Iran’s military heavily relies on missiles as a deterrent; one of Iran’s regional competitors, Saudi Arabia, purchased more than $110 billion in weaponry from the United States in 2017. Iranian officials have said they are not considering making the missile program negotiable.

One hard-liner, Hamidreza Taraghi, said he was not afraid that Mr. Trump’s ultimatum would lead to a collapse of the agreement.

“He is a man who often changes his opinions,” said Mr. Taraghi, an analyst and politician. “Now he wants to send the ball in the Europeans’ court, so that if he fails to do anything against Iran, he will be able to say it is Europe’s shortcoming.”