President Trump says he wants to strike a nuclear deal with North Korea that would benefit “the whole world” by neutralizing a looming threat, and he is willing to trade economic concessions to help make it happen.

That sounds a lot like the bargain President Barack Obama made with Iran in the international nuclear deal that Trump ripped up earlier this month.

Trump has cast the Obama administration’s efforts as the work of overeager and naive negotiators who got fleeced by Tehran, while he will bring a master dealmaker’s approach to his talks with Pyongyang. The result, he says, will be a great deal or a return to the “maximum pressure” approach he took toward Kim Jong Un at the start of his presidency.

“I think it’s going to be a very big success,” the president said during a May 10 campaign rally in Indiana. “But my attitude is: And if it isn’t, it isn’t. Okay? If it isn’t, it isn’t.”

Trump’s divergent views of the two nuclear negotiations, despite their similarities, underscore two of the main drivers of his foreign policy approach — a desire to tear down what Obama put in place and his belief that he can tackle the in­trac­table problems that his predecessors failed to resolve.

So far, Trump has revealed little about the specifics of what he wants out of his meeting next month with Kim beyond getting North Korea to give up its nuclear weapons. He has suggested he would like to strike an accord with Kim that would serve as the framework for more detailed negotiations. The Trump administration has given no estimate for how long the negotiation might take.

However long the bargaining lasts, the boundaries of a North Korea deal and the basic playbook to get that deal would roughly mirror the Iran pact, diplomats and analysts said. The essential trade-off of weapons or potential weapons for economic and other incentives is a diplomatic staple that long predates Trump.

“The Iran nuclear talks were extraordinarily complex and difficult,” spanning 10 years and two administrations from the start of the sanctions pressure campaign to a deal, said former senior State Department official R. Nicholas Burns. “The North Korea case is even more challenging because, unlike Iran, the regime has nuclear weapons and will not want to give them up at all costs. The North Koreans will be frustrating and tendentious and the deal the U.S. likely desires is roughly equivalent to the Iran deal Trump just disavowed.”

Trump’s decision on Iran reimposed economic sanctions that had been suspended under the 2015 deal and which have been the model for some of the sanctions architecture erected against North Korea.

As with Iran, the North Korea sanctions are a mix of U.S. and international restrictions intended to squeeze the country’s ruling elite and draw the leadership to the bargaining table.

The parallels don’t stop there.

Both cases involve a secretive nation with a history of nuclear development and alleged deception, as well as a national narrative of enmity with the United States.

Iran claims it never sought nuclear weapons but nonetheless agreed under the deal to curb nuclear activity it said was related to energy and other peaceful uses. North Korea already has a nuclear weapons arsenal and claims to be able to target the entire United States.

Both cases involve the threat of U.S. military force to stop the advance of a nuclear threat, and the dangling of negotiations as a better alternative. Trump famously threatened last year that he would rain “fire and fury” on North Korea if it menaced the United States or its allies.

Both cases involve agreements with other countries that have leverage and a stake in the outcome. The United States would need China and South Korea, at the least, to make any deal with North Korea stick, and the United Nations would probably be asked to back a North Korean nuclear deal much as it backed the Iran accord.

Trump hasn’t said how he will negotiate a deal with North Korea that will be superior to past international agreements, except by being willing to leave the table if discussions aren’t going his way. If he secures an agreement, Trump will be under pressure to show how he would address what he called the deficiencies in scope and duration of the Iran deal. Notably for North Korea, Trump blasted the Iran deal for failing to address that country’s ballistic missile capability.

Trump also complained that Iran was cheating on the deal, but verifying that North Korea is complying with any agreement could be far more difficult given how opaque it has been to the outside world for decades.

Trump and Kim are scheduled to meet on June 12 for an unprecedented face-to-face negotiation that Trump said has one simple goal: “They give up their nukes.”

Planning for the meeting is going ahead, Trump said Thursday, despite surprise statements from Pyongyang this week that put the session in doubt.

“If the meeting happens, it happens and if it doesn’t we go on to the next step,” Trump said matter-of-factly. “North Korea is talking to us. We are continuing to negotiate when to meet, how to meet. They’ve been negotiating like nothing happened.”

His tone was more upbeat last week, but the message was the same: He wants to talk but would not make what he calls the mistakes of his predecessor.

“We’re not going to walk into an Iran deal,” he said.

Some analysts caution not to draw too close of a comparison between the Iran deal and Trump’s negotiations with Kim.

“President Trump’s exiting the Iran nuclear deal is regrettable but not inconsistent with his pursuing North Korea’s denuclearization,” said Patrick McEachern, a public policy fellow and North Korea specialist at the Wilson Center who is the author of a book comparing the Iranian and North Korean challenges. “President Trump’s effort to get North Korea to give up an existing nuclear arsenal and the means to reconstitute it is a much taller task than President Obama’s concentration on preventing a nuclear weapons-free Iran from getting the bomb in the first place.”

Comparing the two situations is “a bit apples to oranges,” since Iran did not have a full-fledged weapons of mass destruction program and the goal of the deal was to prevent one, said Jenny Town, editor of the North Korea information clearinghouse 38 North.

But more than that difference, Trump’s disdain for the Iran deal is rooted in the fact it was struck under Obama’s watch.

“This is more a case of, the deal is bad because it wasn’t his deal, more than anything else,” Town said.