President Donald Trump loves to boast that he’s the world’s best dealmaker. The problem is he just made a potentially massive negotiating error months before his potential high-profile summit with North Korean leader Kim Jong Un.

On Wednesday night, the Washington Post obtained audio of a Trump speech at a fundraiser in Missouri in which the president made a thinly veiled threat to withdraw US troops from South Korea unless Seoul somehow flows more money into America.

“We have a very big trade deficit with them, and we protect them,” Trump told the crowd. “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.”

That’s music to the ears of North Korean leader Kim Jong Un. Trump’s statement sends a dangerous message right before a potential summit that will feature a historically unprepared US president — and may anger a key ally in the process.

America’s presence in South Korea forms the backbone of Washington’s decades-long alliance with Seoul, which is why Pyongyang hates that US troops are mere miles from the border separating the two Koreas — and why Kim would love to start the upcoming summit with some sign that Trump might be willing to bring US troops back home as part of a broader deal.

“Kim would be delighted by a US withdrawal from South Korea,” retired Marine Lt. Gen. Chip Gregson, the Pentagon’s top Asia official from 2009 to 2011, told me.

Trump has made the troop withdrawal threat for years, including in a 2016 New York Times interview. “We cannot afford to be losing vast amounts of billions of dollars on all of this. We just can’t do it anymore,” he told the Times. North Korea has even publicly approved of Trump’s rhetoric, perhaps hoping to egg him on to follow through with the threat. But experts say reiterating the withdrawal threat so close to an important meeting is poor dealmaking — and could make the negotiations easier on Kim.

“It’s generally a good idea to play your cards close to your vest,” Mintaro Oba, a former State Department official who worked on North Korea policy, told me. “Sometimes you can dangle something big as a way of increasing your leverage,” he continued, “but you still wouldn’t put something on the table that would fundamentally hurt your own interests — and that’s certainly what withdrawing US troops would do.”

Both sides have yet to confirm a Trump-Kim summit will happen, and Washington and Pyongyang have yet to schedule the meeting, although it’s tentatively planned for sometime in May. But Trump just made the first move in the negotiation — and it wasn’t a good one.

Trump remains mad at South Korea. That makes North Korea happy.

Trump has criticized America’s economic and security commitment to South Korea since his presidential campaign.

In March 2016, Trump told the New York Times that he’d consider removing US troops from the peninsula if South Korea didn’t pay more to keep them there. South Korea pays about half of the total cost of US troops in South Korea, and Seoul’s contribution has risen for years.

Here’s the exchange with the Times’s Maggie Haberman:

HABERMAN: Would you be willing to withdraw U.S. forces from places like Japan and South Korea if they don’t increase their contribution significantly? TRUMP: Yes, I would. I would not do so happily, but I would be willing to do it. ... We cannot afford to be losing vast amounts of billions of dollars on all of this. We just can’t do it anymore. Now there was a time when we could have done it. When we started doing it. But we can’t do it anymore. And I have a feeling that they’d up the ante very much. I think they would, and if they wouldn’t I would really have to say yes.

Three days later, Trump told CNN’s Anderson Cooper that South Korea should get nuclear weapons in order to defend itself, so the US wouldn’t have to protect it.

In June 2016, a state-owned North Korean newspaper ran a commentary approving of Trump’s unorthodox proposals.

“The tragedy is that the South’s authorities are incapable of feeling any national shame, no matter how their American masters subject them to an unbearable humiliation,” read the commentary in the state-run Rodong Sinmun. “Their attitude is best shown by the way they got scared by Trump’s comments and groveled.”

Trump has continued to attack South Korea during his presidency. He’s even tried to find a way to amend — or even end — the longstanding free trade deal between Washington and Seoul. One of Trump’s biggest concerns is that the US trade deficit with South Korea — which stands at around $17 billion — continues to grow, as Bloomberg’s chart below shows.

That’s part of what makes Trump’s comment so jarring: He’s hinted at withdrawing US forces before, but never in the runup to what would be a historic — and highly dangerous — summit with Kim.

“At worst, it’ll embolden North Korea to invade or conduct other military provocations,” Oba told me. “At best, North Korea will think it’s something negotiable in talks about its nuclear program.”

That’s the wrong signal to send a regime that has been talking about conquering South Korea for decades but knows that it can’t win if US troops take part in the fighting. There’s a clear reason Kim wants Washington to withdraw its forces, and there’s an equally clear reason Trump shouldn’t be publicly hinting that he might be open to actually doing so.