Last week South Korean President Moon Jae-in and North Korean “Supreme Leader” Kim Jong Un met at the border between the two countries to sign a historic agreement that provides a framework for cooperation and denuclearization which will, per terms in the agreement, lead eventually to the end of the decades-long Korean War. Sensational as this headline is, it also presents several obstacles and uncertainties, a major one being the wishes and interests of the United States, which, in spite of prevailing thought, might actually impede the peace process.

To be sure, over the last three months peace negotiations between the North and South have delivered a number of firsts for the two nations, still technically at war. They reopened direct bilateral talks and fielded a joint Olympic team. Kim has made persistent diplomatic overtures to other countries with stakes in the region, including a trip to meet Chinese President Xi Jinping and a covert meeting with Mike Pompeo, soon to be our new Secretary of State. He’s got a meeting ahead with Donald Trump. The North Korean leader has also offered to have international observers come watch his government dismantle a major nuclear test facility.

A real and lasting peace on the Korean Peninsula would be a remarkable achievement, and perhaps the one truly good thing to happen to the U.S. on Trump’s watch, but it’s far from certain. First, it’s not clear that Trump can even handle negotiations. His ego is a massive liability, and Kim is all too happy to see Trump lay claim to nonexistent victories. Negotiations haven’t begun and he’s already let his ego get ahead of himself in two tweets. This first one simply isn’t true: North Korea hasn’t technically “agreed” to anything, and Trump misunderstands what denuclearization means to them.

And this one suggests Trump’s ego will blow this deal just like he’s blown other deals.

Kim’s plan is obvious: Trump, with the figment of the Nobel Prize and another vanquishing of Obama foremost in his mind, is almost guaranteed to over-commit too early and too loudly (and probably inaccurately) to a peace deal. This will, of course, weaken Trump’s ability to make new demands when Kim shifts his position down the line, and it will give North Korea (and China) more leverage. At minimum, then, we can expect Kim to withdraw from Trump concessions on sanctions while he perhaps makes superficial changes to his nuclear program. He’s not giving up his weapons, and it’s quite possible the whole deal goes bust. At most, Kim will strike a multilateral peace deal that flatters Trump short-term and more or less hands East Asia over to China in the long run. Trump will be fine with this, because he only sees the short term and he only cares about himself. Kim Jong Un would happily endure Trump’s ignorant boasts for a few months, knowing long-term the U.S. will be pushed out of the region.

So it’s not at all clear yet whether an end to the Korean War will be good for America in the long run. Peace on the peninsula will be without doubt a remarkable achievement, but peace doesn’t have to go our way, and lots of things can go wrong even if North Korea begins dialing back its nuclear capability. The U.S. lacks the necessary regional diplomatic strength, ability, and legitimacy to broker and enforce an agreement on our terms, and China will likely step in. Both China and the United States, participants in the war, must sign any formal treaty to end the war, and Russia and Japan also hold major stakes in the future of the Korean Peninsula.

To understand how the end of the Korean War might also mean the end of American dominance in Asia, here’s a quick look at what the region wants out of a deal, country by country. Trump’s problem is he won’t care about what other countries care about: As long as he gets his headlines, the rest of the deal doesn’t matter. But the end of the war isn’t written in the headline. It’s in the fine print.

1. Peace. Yes, peace. Despite the way we frame North Korea as a warmongering wild card, they don’t actually want

war. That would be mass suicide. Kim wants—for a number of reasons, including not getting assassinated or overthrown in a coup—to make his country more prosperous and open up to international markets. He’s promised this to his people since taking control of the country in 2012, and the best way forward is not through war, but through creating a stable and secure diplomatic and economic framework.

2. Denuclearization. All countries want denuclearization of the Korean Peninsula, but this terms means different things to different countries. The U.S., of course, wants North Korea to give up its nuclear weapons immediately. But to North Korea, denuclearization means the entire peninsula: It will give up its nukes (so it says) only if the U.S. also gets its nukes out of the region. Donald Trump showed his ignorance of this basic demand in a recent tweet that claimed, falsely, that North Korea agreed to denuclearization. But they haven’t, because what we’ve seen so far, including the agreement the two Koreas just signed, haven’t defined what that word means. My bet is North Korea will use this disagreement as an excuse to keep its nuclear weapons: But the U.S. won’t give up theirs!?

3. A strong economy. We focus on North Korea’s threats and nukes, which is all our president talks to the American people about, but the whole reason North Korea wanted nuclear weapons was to help achieve the larger long-term goal of turning the country’s economy around. KJU is garbage by almost every possible human measure, but he does want prosperity. He studied in Switzerland and has a fairly good understanding of the West. He knows he can’t stay isolated and hope to survive—literally: he faces coups and assassination. But also, KJU has made this consistent and clear from his very first speech as leader: He wants to rebuild the North Korean economy. But of course, to get there he needs:

4. To get rid of sanctions. Trump is right in that the sanctions currently on North Korea are some of the most restrictive the international community has ever applied. Kim certainly feels the pinch, and he wants them lifted. The minimum goal of these negotiations, it seems, would be to strike some sort of placeholder deal where the international community and North Korea each make good-faith concessions to each other while a larger deal is in the works. This would likely mean lifting sanctions on North Korea to incentivize it to give up its nuclear program. And yes, if that sounds familiar, you’re not crazy: It’s the Iran deal.

But that brings us to…

5. Nukes. It’s not likely North Korea will give up the very thing that brought us to the table in the first place. KJU’s nukes are two things: a point of pride for his country; and insurance against a U.S. invasion. If North Korea can hit the U.S. with a nuclear missile, it effectively eliminates any threat of war. The U.S. won’t risk San Francisco to save Seoul.

And don’t sleep on this key detail: In Kim’s New Year’s speech (the one about the nuclear button on his desk) he didn’t verbally threaten South Korea with war. He offered South Korea peace, and directed the nuclear threat at the United States, and only at the United States. And that segues to another major point:

6. Weaken U.S. friendships in the region. Kim doesn’t trust us or like us, and he doesn’t want us around. So, like any evil manipulator worth his salt, he’s trying to turn our old friends against us. We’ve committed to South Korea’s defense for decades, but Kim, by targeting the U.S. directly, is testing the limits of that commitment. South Korea and Japan have lived for decades under the very real threat of a catastrophic war, but until now the U.S. hasn’t faced that same direct threat from North Korea. “Sure, the U.S. says they love you, but are they willing to take a nuke for you?”

KJU’s bet is that we wouldn’t be. And he’s right.

More broadly, though, KJU probably sees Trump’s disdain for diplomacy as giving him his best shot at winning the peace. This is why Kim has been trying to appear so gracious to South Korea, but not to the United States. The Trump administration hasn’t exactly made friends in the region: He’s threatened nuclear war several times, which makes our allies nervous, and even after a full year in office he still doesn’t have an ambassador to South Korea. It’s no accident Kim has been doing almost all the negotiation on bilateral terms with South Korea, without U.S. officials present. It’s also striking that South Korea hasn’t yet insisted on bringing U.S. officials to sit in on any of these talks. South Korea might actually be warm to the idea of slowly moving beyond the era of U.S. regional hegemony, which would be great for Kim, whose big goal is:

7. To Strengthen China. This is Kim’s end game: Show South Korea he can work with them and honor his commitments; make the U.S. diplomatically and militarily irrelevant; and create (or let Trump create) a leadership vacuum in East Asia that gives China an opportunity to step up. Two things to note: China is North Korea’s only friend; and Kim wouldn’t pursue peace if he thought it’d be good for the United States. He’d only do it if he thought it’d be overall bad for us—and good for China.

What China wants is important, because they’ll have to sign any peace treaty. They’ve got leverage, then, and if they’re getting ready to take the U.S. head-on in a trade war, we can expect they’ll also go hard at our interests here.

1. Peace. No one wants nuclear war in their backyard. And in event of any war, China would be committed to trying to secure their interests. We don’t know exactly what they’d do, either, whose aid they would come to first, but it’s ugly for everyone.

2. A secure and peaceful border. North Korea and China share a border, and both have troops stationed there. China wants to minimize any chance of conflict, but it also wants to guard against waves of defectors.

3. A stronger, more open North Korean economy. China stands to benefit directly when its ally and black market trading partner rejoins the legit global economy. This also offers China a way to exert more influence on regional markets, bending east Asia a little more to its interests. China can take advantage of this window to strengthen its hand and weaken the U.S., and it already seems confident it can succeed here. A New York Times article yesterday said talks about Trump’s new tariffs on Chinese steel and aluminum are in danger of falling apart.

4. No U.S. nukes in the region, and a general drawdown of U.S. military presence in East Asia. Remember that China needs to sign any peace treaty. It will likely advocate for the full denuclearization of the peninsula. This opposes the U.S.’s position, but China has little interest in a treaty that helps the U.S., especially at China’s expense. Any treaty will concern the interests of the U.S. and China as much as any other nation, and either or both country could stall or even tank them if they’re not happy. Expect China to use this treaty to extract demands from the U.S.

5. Weaken U.S. influence and broker peace. China will also try to leverage the Trump administration’s weakness on peace as a reason South Korea and Japan should be wary of any treaty. Trump is a nut, they’ll basically say, who has repeatedly threatened nuclear war and, remarkably, still hasn’t put in place an ambassador to South Korea, the most important party. They’ll use this to further delegitimize the U.S. in the region and present themselves as the natural and trustworthy alternative. Of course, none of this will be said publicly or written in any terms. Publicly they’ll smile and applaud Trump as he tosses rose petals on himself. Privately, though, they might be distancing themselves. This will lead to a long-term economic victory and a stronger East Asian economy made in the shape of China, independent of the U.S.

Japan, however, which mistrusts China, will be a tough sell.

Japan wants three main things out of a treaty:

1. Peace. For the same reasons as every country in the region, Japan doesn’t want a war. They’re within range of North Korea’s nukes, and have been called out as targets. War is a major and terrifying risk.

2. Denuclearization of North Korea. This would obviously be a necessary component to peace.

3. U.S. security. Perhaps as much as South Korea, Japan wants the U.S. there for protection, against both North Korea and possible Chinese aggression. We have a long and committed friendship to Japan, but Trump, however, hasn’t exactly been treating Japan too well. We’re burning bridges, and that might push Japan toward China, and South Korea might follow them, for similar reasons.

1. Peace. Duh.

2. No North Korean nukes.

3. U.S. protection. For the last several decades the U.S. military has guaranteed South Korea protection from North Korea, which since the 80s has had several thousand mortars aimed at the South Korean capital of Seoul right now. If Kim wanted, he could incinerate Seoul within a matter of hours, no nukes necessary. In other words, North Korea has held Seoul hostage for a while now, which has served as a major but not certain check on a U.S. invasion. South Korea will likely make it difficult for any treaty to push the U.S. military out of the region. However, South Korea also needs…

4. The U.S. to agree on denuclearization. It’s important to note that the recent peace agreement, though it commits the two countries to denuclearization, didn’t include too many specifics about how and when North Korea would denuclearize, nor what North Korea would get in the deal. It only “confirmed the common goal of realizing, through complete denuclearization, a nuclear-free Korean Peninsula.”

Two questions: What is “common”? And what is “complete”?

This sets up conflicts. To North Korea, “complete” means getting rid of the U.S. Does South Korea’s “common” interest align with this, or indicate it would be open to agreeing with these terms? This is critical because if North Korea offers to denuclearize completely only if the U.S. does the same in the region, Trump must make a choice. If he doesn’t agree to these terms, he can tank the deal and Kim can point to the U.S. as being the unreasonably militaristic country: It’s our fault it didn’t go through.

At the same time, if the U.S. does back down then it telegraphs that we’re not willing to sacrifice San Francisco to protect Seoul. And remember: China must agree to the terms of the treaty, and they don’t want U.S. nukes around any more than South Korea does.

1. Peace? Until now it could be said without doubt that the U.S. wants peace. War is still off the table, though, because it would be unimaginably devastating for the U.S. military, Seoul, American citizens in South Korea, all of East Asia, and the global economy. But Trump himself (and new NSA John Bolton) doesn’t seem to necessarily want it that way. I still have confidence, though, that the costs will outweigh any perceived benefits to military conflict, which is now more true than ever given North Korea’s missiles can perhaps now reach U.S. cities. Will we still go all out to protect South Korea and Japan? Not so clear.

2. Peace Prize? This is what Trump wants. As mentioned before, of course, his ego is his biggest weakness. He’s going to promise too much too quickly, and make himself seem like the person solely responsible for the deal. Then when Kim reneges on some terms, Trump will be willing to give up a lot more simply to save face. With Trump’s ego distracted, the rest of the region can set the real terms.

2. Denuclearization, sorta. We’ve strictly maintained that North Korea must denuclearize completely, but we’ve never had that on the table ourselves. We’ve also promised to keep our military in the region to guarantee protection and check North Korean advance. We’ll therefore resist any demand to remove our nukes and troops, but that runs the risk of making us seem too bellicose. That’s especially true if South Korea calculates it would be worth a peace long in the making.

3. Domination. We’ve guided and guaranteed the economic development of East Asia, through trade and our clout as by far the largest global economy. The United States is directly responsible for the rise of Japan and South Korea, and they have a long-standing friendship with us.

So that is what it comes down to: We don’t want to forfeit our influence in the region, but any treaty will almost certainly weaken our position, and under Trump this is even more likely. It will likely also expose on the global stage our hypocrisy about military and nuclear policy. North Korea has likely planned this out, and will use peace, of all things, to drive a wedge between the U.S. and the other East Asian countries. China has every incentive to seize the same opportunity and assert itself as the dominant country in the region.

Kim Jong Un doesn’t trust us any more than we trust him. There are plenty of reasons on all sides that a treaty could fail, but if you look to the long term, a successfully negotiated Trump deal might be even worse. At least, for us.