What does Donald Trump’s stance on the Iran deal have to do with his relationship with North Korea? It turns out, quite a lot.

Trump just announced that he will withdraw the US from the Iran nuclear deal — and that could likely hurt his chances of reaching a significant weapons agreement with Pyongyang.

There’s a simple reason why, experts tell me: Backtracking on America’s promises to Tehran means then North Korean leader Kim Jong Un has no reason to trust Trump during negotiations about Pyongyang’s nuclear and missile programs.

“If I were the North Koreans, and Trump pulled out of the deal with Iran, why should I make an agreement?” Frank Rose, a top arms control official at the State Department from 2014 to 2016, told me. Senate Foreign Relations Committee Chair Bob Corker (R-TN), a GOP leader, also says that leaving the Iran deal would make signing a North Korea deal “more difficult.”

Trump also announced that he’s sending Secretary of State Mike Pompeo to North Korea for meetings. That would be his second trip to North Korea, likely to meet Kim. It’s possible they will discuss the plight of America’s three hostages if and when they meet.

Trump’s Iran deal withdrawal announcement comes about a month before Trump plans to meet with the North Korean leader. Trump says a meeting location and time have ben set, but those have yet to be made public.

But if Trump asks Kim to curb North Korea’s improving nuclear weapons and missiles program, the US’s Iran deal reversal will still be fresh in Kim’s mind — and could increase the chances of a failed summit.

This major hurdle aside, experts note that Trump has already made mistakes ahead of the possible encounter. In March, the president unveiled $60 billion worth of tariffs on China, North Korea’s closest ally. Washington requires Beijing’s help to starve North Korea of money to fund its weapons programs, but an economic fight might make China less willing to work with the US.

As if that weren’t enough, Trump has repeatedly threatened to remove US troops from South Korea. America’s military presence on the peninsula forms the backbone of Washington’s decades-long alliance with Seoul. This move likely angers a key ally and helps Kim guess what Trump might put on the negotiating table.

That only adds to Kim’s negotiating power, which was already quite strong. “Kim feels he can come to the table with confidence because of the advances he’s achieved in his nuclear and missile program,” Suzanne DiMaggio, a North Korea expert at the New America think tank, told me. Remember: Last year, North Korea proved it has a missile capable of hitting all parts of the United States and most of Europe, as well as a massive nuclear bomb.

Trump likes to boast that he’s the world’s greatest dealmaker. But he’s not looking his best right now, as he heads into a high-stakes summit with Kim.

Iran isn’t violating the Iran deal. That doesn’t matter to Trump.

It’s worth briefly stepping back to remember why Trump is angry at Iran in the first place.

But first, here’s what the Iran nuclear deal actually is: A group of countries — the United States, the United Kingdom, France, Russia, China, Germany, and the European Union — agreed in July 2015 to lift sanctions imposed on Tehran’s nuclear program, giving it greater access to the global economy.

In return, Iran agreed to take concrete steps to curb its nuclear program, limiting it to strictly peaceful applications and to allow the International Atomic Energy Agency to inspect their key nuclear facilities to ensure compliance.

The Obama administration finalized the Iran deal, despite staunch congressional opposition. It’s also worth noting that Congress’s role in certifying any deal with North Korea could scare off Pyongyang, as Kim can’t trust whatever agreement he strikes with Trump will survive the Hill.

Still, the Iran deal sounded good to most lawmakers and officials in the Obama era, considering Tehran agreed to it just two or three months before acquiring a nuclear bomb.

But the deal still isn’t good enough for Trump.

Trump says Iran is violating the “spirit” of the deal because it continues to test missiles. That potentially goes against a United Nations Security Council resolution — which is separate from the Iran agreement — that says Iran can’t test missiles that could carry nuclear weapons. But experts have told me testing missiles is different from the limited scope of the nuclear deal, which just focused on limiting Iran’s nuclear capabilities.

Still, Trump seems to think he has a good case to pull the US out of the Iran deal on May 12. It would surely rattle relations with Tehran — and have the unintentional side effect of making it harder to broker peace with Pyongyang.

Let’s give Kim something to talk about

Kim is very likely to pay close attention to Trump’s Iran deal decision. “The North Koreans are going to watch intensely,” Troy Stangarone, an expert at the Korea Economic Institute, told me.

And if Trump decides to pull out of the accord, “it would have an impact on any potential deal with North Korea,” according to Rose, who is now at the Brookings Institution think tank. But it’s unclear how much of an impact, since “the prospects of the North Koreans giving up their nuclear weapons are very, very slim,” Rose said.

So if Pyongyang won’t disarm, what will Trump and Kim discuss?

DiMaggio, who leads unofficial dialogues with North Koreans, told me Pyongyang is “ready to turn their attention to economic development. This is a proposition we should be testing with the North Koreans to see if they’re really serious about it.”

In practice, that means Trump could offer aid to North Korea, like helping to build up the country’s energy infrastructure or investment in its lagging private sector, experts told me.

The US and North Korea have discussed this before. In September 2005, North Korea formally agreed to abandon “all nuclear weapons and existing nuclear programs” in exchange for energy assistance from countries, including the US, in the so-called Six Party Talks. Those talks broke down in 2009, and the difference now is North Korea’s weapons are much more powerful today — which means Kim has even less incentive to give them up.

Still, in exchange for financial help, experts told me Trump could ask North Korea to keep its weapons but allow international inspectors to ensure they’re not improving their programs in any way. That could be a potential win-win for Kim: He gets more money, and he gets to keep his threatening program as menacing as it is now.

But it’s also likely Kim will test Trump’s willingness to remove US troops from South Korea. After all, Trump has repeatedly claimed he’ll bring service members home unless Seoul somehow flows more money into America. “We have a very big trade deficit with [South Korea], and we protect them,” he told a crowd in Missouri last week. “We lose money on trade, and we lose money on the military. We have right now 32,000 soldiers on the border between North and South Korea. Let’s see what happens.”

Stangarone told me that Kim would be foolish if he didn’t ask for US troop removal, and “we’d be foolish if we accepted.” Here’s why: One of North Korea’s top goals is to drive a wedge between Seoul and Washington. Should the US bring troops back stateside, it would be harder for the US to defend South Korea against North Korean military threats. That would put a massive strain on the alliance.

The problem is it’s unclear what Trump will and will not do at the possible summit. Throughout his presidency, he has shown again and again how little he cares about the details of international relations. Remember: This is the same guy who firmly believed Mexico would pay for a border wall. Also, Chinese President Xi Jinping convinced Trump that Beijing doesn’t have total influence over Pyongyang after only 10 minutes of conversation.

Newell Highsmith, who has negotiated nuclear deals with Iran and North Korea over multiple administrations, told me that nuclear discussions are among the most complex conversations between countries. And since Trump and Kim may meet before lower-level staff can lay any serious groundwork, Highsmith says Trump and Kim could discuss multiple topics, though leaders usually meet each other to finalize a few items.

That means Trump will likely be underprepared and overwhelmed in talks with Kim. Experts told me Kim may have other motives for the meeting instead of a nuclear talk: obtaining prestige by sitting down with a US president, or even simply trying to get a better feel for who Trump is. North Korea doesn’t have to trust Trump to chat with him.

“North Korea has been able to bring the US to the negotiating table,” Rose told me. “There’s a political-military strategy behind what North Korea is doing.”

As of now, it’s unclear whether Trump has a similar plan.