Sigmar Gabriel, Germany’s foreign minister, said that Mr. Trump was sending “a difficult and also from our point of view dangerous signal.”
He said that the Iran deal, and other diplomatic achievements, were necessary “to convince countries like North Korea, and maybe also others, that it is possible to create security without acquiring nuclear weapons.”
“Destroying this agreement would, worldwide, mean that others could no longer rely on such agreements — that’s why it is a danger that goes further than Iran,” he added.
Reaction from Iran was quick and pointed. Appearing on television, its president, Hassan Rouhani, denounced Mr. Trump and called the United States an outlier that had become “more lonely than ever” in the international community. Mr. Rouhani did not threaten to withdraw from the deal, but made it clear that he would not renegotiate the terms, either.
“The statements of Mr. Trump are nothing but abuse and threats against the people of Iran,” he said. “An international agreement cannot be disregarded.”
The European leaders noted that the United Nations Security Council had unanimously endorsed the deal, and that the International Atomic Energy Agency had confirmed Iran’s compliance with it.
But Mr. Trump’s aggressive stance on Iran won plaudits from several nations on Friday, specifically from adversaries of Iran like Israel, Saudi Arabia and the United Arab Emirates.
Benjamin Netanyahu, the Israeli prime minister who has always opposed the agreement with Iran, said that Mr. Trump’s announcement created “an opportunity to fix this bad deal” and was a sign of Mr. Trump’s determination to “boldly confront Iran’s terrorist regime.”
Saudi Arabia, which has waged a proxy battle against Iran for supremacy in the region and was the first country Mr. Trump visited after taking office, said it welcomed what it called a “new U.S. strategy” toward Iran.
The United Arab Emirates, which like Saudi Arabia is a predominantly Sunni Muslim country with a sizable Shiite minority, also said that it “fully supports” Mr. Trump’s stance on Iran.
Some leaders declared that the deal, reached in 2015 between Iran and six world powers, including the United States, was not something that Mr. Trump could cancel, contending that Mr. Trump was essentially putting on a show for his political base.
“The president of the United States has many powers — not this one,” the European Union’s top diplomat, Federica Mogherini, said at a news conference in Brussels.
She said that there had been no violations of the agreement and that the world could not afford to dismantle an accord that “is working and delivering,” especially at a time of “acute nuclear threat,” referring to the standoff with North Korea over its nuclear program.
Criticism of the nuclear deal was a central theme of Mr. Trump’s candidacy for president, and he has repeatedly called for revisiting what he sees as a fatally flawed agreement.
Mr. Trump said on Friday that under the current deal “Iran can sprint” toward the development of nuclear weapons when the deal’s restrictions expire.
Some of the prohibitions in the agreement are set to end in 2025, including limits on the number of its centrifuges. Iran, which has always maintained that its nuclear program is for peaceful purposes, not for weapons, would not agree to a permanent freeze in its ability to enrich nuclear fuel.
That must be changed, Mr. Trump said, or he would scrap the deal altogether.
Russia, which took part in the negotiations to reach the accord and has warned Mr. Trump not to rescind it, said that the president had no basis for disavowing the deal.
“Iran is abiding” by the nuclear agreement, Mikhail Ulyanov, a director at the Russian foreign ministry, told the Interfax news agency. “Everyone agrees with that. And an attempt to somehow heighten the tensions in this situation looks like unmotivated aggression.”
In blunt language, Ms. Mogherini, the European Union’s top diplomat, essentially looked past Mr. Trump and appealed to Congress directly.
America’s next step “is now in the hands of the United States Congress,” she said. “The international community and the European Union with it has clearly indicated that the deal is and will continue to be in place.”
Russia urged American lawmakers to preserve the deal as well.
“We want to hope that Congress will not take any dramatic steps which would effectively signify a collapse” of the deal, Russia’s deputy foreign minister told Interfax, referring to the renewed sanctions that might lead Iran to nullify the accord.
In his remarks, Mr. Trump accused Iran of violating both the letter and the spirit of the accord. But Iran has accused the United States of doing the same, and on Friday its mission to the United Nations warned that Iran might itself back away from the deal.
“Iran has many options on how to proceed and if necessary will terminate its commitment regarding this issue,” the mission said in a statement, without elaborating.
Iran has also resisted the idea of renegotiating the nuclear agreement in the West’s favor. Last month, its foreign minister rejected extending the length or conditions of the accord, saying that Iran would consider changing the agreement only if the concessions it had already made — including giving up nuclear fuel — were reconsidered.
There are fears that the basic framework of the accord could collapse if the United States walks away. Dmitri S. Peskov, the Kremlin spokesman, told reporters on Friday that Russia believed Iran would abandon the deal if the United States did.