On June 12, all eyes were on U.S. President Donald Trump and North Korean leader Kim Jung Un, in the first ever meeting between the heads of states of the two countries. Although pundits debate whether it was North Korea or the United States that benefited the most from the summit, there was a less visible player that came out a clear winner: China.

China’s North Korea policy is primarily motivated by the desire to counter U.S. power in the region and increase Chinese influence on the Korean Peninsula. Along those lines, Beijing had two main objectives that came to fruition in Singapore.

Its first goal was reciprocal de-escalation on the peninsula. In September, the United States had rejected this “freeze for freeze” formula—that the United States would cease military exercises on the peninsula and in exchange North Korea would stop all nuclear-program-related tests. U.S. ambassador to the UN Nikki Haley had called the proposal “insulting” and the State Department had pushed back against the implication that legitimate and legal U.S.–South Korean alliance activities were equated to dangerous and rogue North Korean behavior.

China certainly made its agenda clear to Pyongyang. Last March, according to South Korean National Security Adviser Chung Eui-yong, the North Koreans couldn’t have cared less about China’s dual freeze formula. Chung told Trump during a visit to the White House that Kim “understands that the routine joint military exercises between the Republic of Korea and the United States must continue.” The following month, Kim declared a unilateral suspension of his country’s nuclear and missile tests, asking for nothing in return.

Trump's statement that the exercises were "provocative" and "inappropriate" could have come straight from the Chinese propaganda machine.

Then suddenly, in May, North Korea did an about-face, citing U.S.–South Korean military drills as the reason for its suspension of planned talks with the South. Kim’s change of heart was likely due to his meeting the week prior with Chinese President Xi Jinping in Dalian, China. Xi could not abide the damage, both to his prestige and to Chinese interests, of Kim’s slight. He probably insisted that Kim do his utmost to get Washington to halt U.S.–South Korean military drills at the Singapore summit with Trump.

After the June 12 summit, to the surprise of many at the Pentagon, as well as in Seoul and Tokyo, Trump made a public promise to indefinitely suspend the military exercises. Many experts were rightly concerned that this was a large concession with potential repercussions for the U.S.–South Korean relations since Washington got nothing but vague assurances of denuclearization in return.

Trump’s willingness to negotiate on these points undermines Washington’s narrative that the U.S. military role in the region is necessary for peace and security. His statement that the exercises were “provocative” and “inappropriate” could have come straight from the Chinese propaganda machine, and gives Beijing wins on multiple fronts. What is more, his decision advances China’s goal of weakening U.S. alliances with South Korea and Japan, which are key to Washington’s ability to project power and influence in the region. Beijing now has more fodder to push back against U.S. operations in the South China Sea and East China Sea as well.

But nothing could have surprised and delighted China more than Trump’s comment that he wanted to eventually get U.S. troops out of South Korea altogether. If the United States actually moves to reduce or eliminate its troop presence on the Korean Peninsula, this would be the biggest win of all for Beijing.

China’s second goal was to make sure that if there were discussions about signing a peace agreement to officially end the Korean War, it would have a seat at the table. After the April 27 North and South Korean summit, when the leaders of the two countries agreed to pursue future negotiations for a peace treaty, there was speculation that Kim and Trump might begin discussions in Singapore about replacing the 1953 armistice with a peace treaty. This would be a big step for the United States. Washington had previously refused to entertain the prospect of a peace deal without a resolution of the North Korean nuclear and missile issues, human rights abuses, and terrorist activities. China, on the other hand, is supportive of a treaty, as it would make it more costly and difficult for the United States (and North Korea) to use force and it would also pave the way for the removal of U.S. troops from the peninsula.

Nothing could have surprised and delighted China more than Trump's comment that he wanted to eventually get U.S. troops out of South Korea altogether. If the United States actually moves to reduce or eliminate its troop presence on the Korean Peninsula, this would be the biggest win of all for Beijing.

In the run-up to the Trump-Kim summit, there were hints of anxiety in Beijing that China might be excluded from talks on a peace accord. On June 4, China’s state-run tabloid, the Global Times, noted in an editorial that a peace treaty signed by only the United States and North Korea would be invalid and could be overturned. Chinese worries were likely triggered by the suggestion put forward by Moon and Kim at their inter-Korean summit that a permanent peace treaty could be pursued either three-way, among the two Koreas and the United States, or four-way, to also include China. Xi probably later told Kim that omitting China was out of the question.

Beijing again got its wish. In the joint declaration signed in Singapore, Kim and Trump pledged “to join their efforts to build a lasting and stable peace regime on the Korean Peninsula,” with Trump later indicating during his press conference that both China and South Korea should be included in any peace talks. China’s foreign ministry endorsed the proposal, saying, “China is willing to join hands with all relevant parties to stay committed to realizing the denuclearization and establishing a peace regime on the peninsula.”

That China got all that it wanted out of the summit is no accident. The sudden turn of events created by Trump’s announcement that he was willing to meet with Kim created both danger and opportunity for Beijing. There was palpable risk of China being marginalized as the geopolitical landscape shifted on the Korean Peninsula. But the prospect of a Trump-Kim summit also presented China an opportunity to influence the course of history to its advantage. Xi seized this opportunity, using Chinese sway over Pyongyang, which many thought had evaporated long ago. It is now clear that for Beijing, the ultimate goal of the surprise meeting between Xi and Kim in March was to shape the direction of the upcoming U.S.–North Korean talks and to ensure that any outcome favored Chinese interests over those of the United States. There is ample evidence that China deftly orchestrated the summit to do just that.

Unfortunately for the United States, the effects of China’s diplomatic ingenuity will reverberate far beyond North Korea. In the game between great powers, China just scored multiple points against the United States. And if China is able to continue leveraging the North Korea issue to radically weaken U.S. alliances, reduce U.S. military presence and operations, and undermine the legitimacy of the U.S. role in the region, it will be game over for Washington in the Asia Pacific.