Iran on Tuesday took advantage of President Donald Trump’s abandonment of the landmark 2015 nuclear deal, portraying itself as a law-abiding state ready to work with traditional U.S. allies to avoid war.

In a defiant address to the United Nations General Assembly, Iranian President Hassan Rouhani paid back every bit of Trump’s earlier invective against Iran with interest. “It is unfortunate that we are witnessing rulers in the world who think they can secure their interests better, or at least in the short term ride public sentiments and gain popular support through the fomenting of extremist nationalism and racism and through xenophobic tendencies resembling a Nazi disposition,” Rouhani said at the beginning of his 25-minute speech.

This was hours after Trump called Rouhani “an absolutely lovely man” in an early-morning tweet. And it was a message to Trump not to bother reprising the threaten-and-flatter approach with Iran that he used on North Korea.

John Kerry, Barack Obama’s secretary of state who negotiated the nuclear deal, warned the Senate in July 2015 that, “If we walk away, our partners will not walk away with us… whatever limited economic pressure from sanctions would remain would certainly not compel Tehran to negotiate or to make any deeper concessions.”

Rouhani’s fundamental approach on Tuesday, both in his speech and before, was to vindicate Kerry by exploiting every division between Europe and America that Trump created by violating the accord. Ahead of taking the General Assembly stage, Rouhani dismissed what he called multiple entreaties by the Trump administration for a dialogue that Kerry successor Mike Pompeo proposed could result in a comprehensive treaty.

Instead, Rouhani presented a precondition: return to the nuclear deal, and then dialogue can proceed. He taunted Trump for abandoning the deal “because it is the legacy of your domestic political rival,” and said there was “no need for a photo opportunity,” something that sounded like a dig at Trump’s embrace of North Korea’s Kim Jong Un. Above all, Rouhani repeatedly referred to United Nations Security Council 2331, which on a unanimous vote gave the Iran deal the imprimatur of international law. After repeated accusations from the U.S. that Iran has violated the missile-related provisions of 2331, Rouhani relished in the turnabout.

“Unlawful unilateral sanctions” re-imposed by the U.S. are “economic terrorism,” Rouhani declared: “Our proposal is clear: commitment for commitment, violation for violation, threat for threat, and step for step.”

As Kerry predicted, the U.S. allies aren’t going along with the snapped-back sanctions, as the nuclear inspections, made much stronger by the Iran deal, have fond consistently that Iran is in compliance.

The European Union, in a slap to Trump, is setting up a way for European companies to continue to do business with Iran and evade sanctions, a step it considers necessary to keep Iran from reactivating its nuclear-weapons program (something Rouhani disingenuously suggested in his speech was an “artificial crisis”). That measure got additional diplomatic support on Tuesday from China, France, the U.K., and Russia.

“This is one of the most counterproductive measures imaginable,” Secretary of State Mike Pompeo said before an anti-Iran crowd in New York Tuesday under the auspices of the nonprofit United Against a Nuclear Iran. Pompeo said the countries taking part are “enabling Iran’s violent export of revolution,” by helping them avoid sanctions.

Pompeo’s frustration was likely increased when Rouhani—whose sponsorship of Syrian strongman Bashar Assad has led to an orgy of blood and the devastation of Syria—told the U.N. with a straight face that “those seeking dominance and hegemony are the enemies of peace and the perpetrators of war.” And it came as the Trump administration is showing every sign of gearing up for a confrontation.

“The murderous regime and its supporters will face significant consequences if they do not change their behavior,” Trump’s national security adviser, John Bolton, said in remarks released shortly after Rouhani finished speaking. “Let my message today be clear: We are watching, and we will come after you.”

Bolton, who has long advocated a preventive military attack on Iran, created confusion on Monday by redefining the U.S. military mission in Syria away from the stated goal of fighting the remnants of the Islamic State and toward a lasting troop presence pegged to countering Iran’s own. The State Department’s senior Iran official, Brian Hook, later said that the U.S. military would focus on the remnants of the so-called Islamic State, but that U.S. diplomats would also work to make sure Iranian militias withdrew as part of hoped-for peace deal in Syria.

By contrast, Rouhani noted—accurately—that Iran was “in Syria at the request of the Syrian government, consistent with international law.” Rouhani also took a swipe at Bolton’s “approach to the International Criminal Court,” which Bolton recently threatened with sanctions and prosecution should it investigate alleged U.S. war crimes in Afghanistan, further portraying the U.S. as the real rogue nation.

Alongside Gulf-nation ambassadors, the State Department’s Hook indicated that there would be no let-up in the Trump administration’s punitive approach to Iran.

“If talking to the Iranians worked, we wouldn’t be in this position. They only seem to respond to pressure and isolation,” Hook said at the United Against a Nuclear Iran event.

That was precisely the sort of sentiment that Rouhani repeatedly worked to undermine by invoking the 2015 nuclear deal and accompanying Security Council resolution. His bet is that a General Assembly that hours earlier laughed at Trump will consider the deal proof that Hook’s assessment is more invidious than a long pattern of Iranian aggression.

“The United States’ understanding of international relations is authoritarian. In its estimation, might makes right,” Rouhani said. “Its understanding of power, not of legal and legitimate authority, is reflected in bullying and imposition.”