South Koreans took to the streets Saturday, some looking forward to a warm welcome for U.S. President Donald Trump, others to protest his imminent arrival. Trump will be the first American leader in 25 years to make a state visit to the Republic of Korea, as the South is formally known. He lands in the South Korean capital Tuesday.

Trump’s visit is the second on his five-nation tour of East Asia. Even though the stop is short and sandwiched between Tokyo and Beijing, the discussions in Seoul could well be the most consequential of the trip.

There are two showdowns looming.

Most every analyst says the Chinese capital will be the highlight of Trump’s tour, the most important stop by far. China is undoubtedly the most powerful country the 45th president will see on his 13 days in the region, but Beijing leaders will almost certainly take their cue from what happens during the first two stops.

The Chinese, like everyone else, knew in advance what would happen in Japan, where the visit was baked in. Yes, Trump’s arrival comments at Yokota Air Base in Tokyo were surprising—by denigrating “dictators” he took shots at both China’s Xi Jinping and North Korea’s Kim Jong Un—but there is little that can go wrong while he is on Japanese soil.

Even before Trump left Honolulu for Tokyo, relations between Trump and Prime Minister Shinzo Abe were a “love-fest,” and they became even warmer when on Sunday the Japanese leader presented his American guest white trucker hats adorned, in Trumpian gold thread, with “Donald & Shinzo Make Alliance Even Greater.”

The use of the first names evoked the friendship of “Ron and Yasu,” Reagan and Nakasone. Said Trump at dinner on Sunday, without much exaggeration: “I don’t think we’ve ever been closer to Japan than we are right now.”

In contrast, America and South Korea are not particularly close at the moment. Like Japan, South Korea is bound to the U.S. by a mutual defense treaty. Unlike Japan, South Korea has a leader who does not particularly like America.

In fact, President Moon Jae-in, despite what he is forced by political considerations to say in public, is perhaps the most anti-American, pro-China, and pro-North Korean leader the South has ever had, probably surpassing in this regard his old boss, Roh Moo-hyun, who governed South Korea from 2003 to 2008.

In Moon’s conception of the world, South Korea should practice “balanced diplomacy” between Washington and Beijing, even though the U.S. is the only nation committed to defending the South, and China is fast arming Seoul’s arch-enemy, North Korea. So far Trump, engaging in some deft diplomacy, has boxed Moon in, preventing him from doing too much damage to the alliance.

The so-called progressive South Korean leader, however, has been looking for ways to weaken ties with America, and on Tuesday he found one. Then, the South Korean and Chinese foreign ministries issued a joint statement putting a long-running feud behind them.

For years, Beijing had been pressuring Seoul to prevent the deployment on South Korean soil of the Terminal High Altitude Area Defense system. When the campaign to stop THAAD, as the American-built missile-defense is known, failed, the Chinese targeted South Korean businesses operating in China, especially the Lotte Group. They also blocked imports from South Korea and limited Chinese tourism to the South. Beijing was outraged that Seoul ignored its concerns that the system’s radar would peer into Chinese airspace.

Whether the THAAD radar could do that or not, Beijing’s campaign was particularly outrageous because the anti-missile system addresses a threat China had enhanced. China had directly aided, by supplying crucial equipment and probably highly advanced technology, to the North’s ballistic missile program. Beijing had also allowed, over the course of decades, Chinese enterprises to supply components, equipment, and materials to Pyongyang’s nuclear weapon’s efforts.

Moon evidently took none of this hostile conduct into account. In order to obtain Tuesday’s agreement with Beijing, he apparently gave what is now known as the “Three Nos.” South Korea agreed to not host any additional THAAD batteries, not participate in an integrated missile defense system, and not join in a South Korea-Japan-U.S. alliance.

As David Maxwell, a retired U.S. Army Special Forces colonel who served five tours of duty in South Korea and is now at Georgetown University, told The Daily Beast, the agreement has “alliance implications.”

“President Moon,” says Maxwell, “appears to have made a unilateral decision that undermines effective military defense of the Republic of Korea and limits U.S. political-military action without any apparent or known consultation with Washington.”

In short, Moon’s accommodation with Beijing was inconsistent with the alliance with America. The conservative Chosun Ilbo, in the headline of a Wednesday editorial, described Moon’s agreement with China this way: “Gov’t Has Capitulated to Chinese Bullying.”

And while Moon has been making deals with Beijing behind Washington’s back, the South Korean leader has allowed subordinates to mischaracterize the command structure of alliance forces and thereby undermine the ability of the United States to defend his own country. In short, Moon’s officials have been complaining that a U.S. general would command South Korean troops in the event of a North Korean attack.

“President Moon’s advisers know full well the U.S. does not have command of ROK forces,” says Maxwell, using the initials of South Korea’s formal name. “The Moon administration should explain the nature of the command relationship to the Korean people and inform them that the ROK president has equal authority and control over the ROK/U.S. Combined Forces Command.

“The Military Committee ensures equal authority and control over the combined command,” says Maxwell, “and it is time for the ROK leadership to both state that in public and take equal responsibility for the combined command and the defense of the ROK.”

And if Moon’s geopolitical mischief is not bad enough, trade friction between the United States and South Korea is at or near an all-time high, especially because the Korea Fair Trade Commission has, after denying procedural guarantees contained in the U.S.-South Korea Free Trade Agreement, slapped a $912.3 million fine on San Diego-based Qualcomm and imposed a forced-licensing scheme.

President Trump, therefore, has a lot to talk about with Moon. The American president has every right to tell off his counterpart in public, but a rupture in the alliance will surely suggest to Chinese leaders that their troublemaking is paying dividends. And if they feel that way, they will surely become even more recalcitrant when Trump arrives in their capital.

If, on the other hand, Trump can accomplish the near-impossible and get Moon to publicly renounce the Three Nos, Beijing will sit up and begin to respect American power.

The discussions in Seoul, therefore, set the table for tough bargaining in Beijing. Trump now has a big incentive to accomplish the near-impossible in the showdown to come in Seoul.

And the second showdown?

The North Koreans are bound to do something provocative while Trump is in the South Korean capital. As Bruce Bechtol, author of North Korea and Regional Security in the Kim Jong-un Era, told The Daily Beast, “Brinkmanship is likely while Trump is on his visit.”