In a not-so-secret meeting on Tuesday, Chinese President Xi Jinping and North Korean leader Kim Jong Un set aside their rumored mutual disdain for each other and met officially for the first time.

In recent weeks, Beijing seemed blindsided when President Trump accepted an invitation to meet with the North Korean leader. Xi’s meeting with Kim this week offered China a way to reinsert itself into the diplomatic narrative.

But despite Xi’s opportunity to play host and international broker, his talks with Kim — and his warm words and offer to make a return visit to Pyongyang — reflected not strength but Beijing’s anxiety about its role in the upcoming talks over denuclearization, as well as China’s relationship with North Korea.

Here are three takeaways from Kim’s visit to China:

1) China fears being sidelined.

Beijing is not only a close neighbor, but also a longtime partner and ally of North Korea. And no international effort to increase pressure on North Korea has much chance of success without China’s acquiescence on sanctions.

But this status has not always earned China a seat at the table on matters involving the North, in part because the Kim family has had good reasons to believe that Beijing may wish to replace them with more pliable reformers.

The recent diplomatic frenzy by the Koreas and Washington was not the first time China found itself on the outside looking in as major developments in North Korea diplomacy unfolded. In the 1970s, North Korea did little to keep China in the loop as it negotiated the possibility of normalization with Seoul. When Washington and Pyongyang negotiated in the early 1990s to freeze North Korea’s nuclear program, China had no formal role.

Does Kim’s recent visit to Beijing mean the two countries will now coordinate smoothly on denuclearization negotiations? Probably not — for starters, Kim’s visit may have simply been wise diplomatic protocol. It would have been a serious diplomatic offense to Beijing, a long-standing socialist ally, if Kim’s first meeting with a foreign leader were with Trump or South Korean President Moon Jae-in.

In addition, as former assistant secretary of state for East Asian and Pacific Affairs Daniel Russel notes, Kim’s trip to Beijing may be a gambit “to divide the five countries that have been involved” in talks over denuclearization — not an enduring change in North Korea’s ties with China. The fact that China has struggled to restrain North Korea on its nuclear program raises doubts about its ability to force North Korean coordination in the upcoming negotiations.

2) China can’t afford to take a back-seat role in the upcoming talks. 

China has strong reasons to insert itself into diplomacy that, at least in recent months, has largely been led by the two Koreas and the United States.

If talks move forward without China, then Beijing’s aspirations for regional leadership will suffer. For that reason, China’s diplomats and state media have worked tirelessly to seize credit for the latest developments. Soon after news broke of Trump’s willingness to meet Kim, Chinese Foreign Minister Wang Yi declared that China “created the basic conditions for the improvement” by advocating a freeze on U.S. and South Korean exercises in exchange for a freeze on North Korean missile testing.

There’s another looming motivation, from Beijing’s view. If talks fail, there is an increased risk of a conflict that would send refugees across the Chinese border, or potentially involve nuclear weapons. This might be the reason for Wang’s effort to lower expectations. “The journey ahead won’t be smooth,” he recently declared, “history has reminded us time and again that whenever tensions subsided on the Peninsula, the situation would be clouded by various interferences.”

3) China will use formal and informal tools to shape talks.

For years there was evidently little coordination between China and North Korea. Not only did the two leaders not meet each other, but there were rumors that Kim refused to meet China’s ambassador in Pyongyang.

Xi’s invitation for Kim to visit Beijing seems to reflect China’s push to reclaim the initiative after months during which the two Koreas set the pace on diplomacy. In the months ahead, look for China to try to increase its informal influence in talks through closer ties with North Korea, but also boost its formal influence through a more institutionalized negotiating process.

China’s path to relevance in regional talks runs through Pyongyang — one reason Xi suddenly seems to be over his antipathy to Kim. Shortly after taking power, Kim executed his own uncle, who had developed close ties with the Chinese leadership.

North Korea’s subsequent nuclear testing — including during important Chinese political events — and Beijing’s recent support for U.N. sanctions added layers of substantive disagreement to a relationship already suffering under the weight of historical distrust and personal animosity. In recent years, China even reportedly limited the scope of the alliance by suggesting it would not apply to a conflict North Korea initiated.

After this week’s Xi-Kim meeting, official Chinese statements suggested that a careful attempt to reset relations was underway. A Xinhua news release included warm praise, memories of historical bonhomie and declarations of “profound revolutionary friendship.”

China is also staying in the game by seeking to institutionalize its role in the talks. After news broke of Trump’s interest in meeting with Kim, China’s foreign minister reminded reporters of the importance of “bilateral and plurilateral” approaches that would implicitly and more formally include China.

On Wednesday, Foreign Ministry spokesman Lu Kang declared that “the Six-Party Talks serve as an important platform for promoting the settlement of the Korean Peninsula issue” and called on all sides to “resume it at an early date.” The Six-Party model from the 2000s would not only give China a clear role, it might even allow Beijing to exercise leadership.

With the possibility of U.S.-North Korean talks looking increasingly credible, Beijing has strong incentives to push for full involvement in the forthcoming talks. Diplomacy over North Korean denuclearization remains fluid and volatile, but one thing remains clear: Xi Jinping won’t be content to stay on the sidelines.

Rush Doshi is a PhD candidate at Harvard University, an adjunct fellow in the Asia-Pacific Security Program at the Center for a New American Security, and a pre-doctoral fellow at GWU’s Institute for Security and Conflict Studies.