A phalanx of 23 police motorcycles greets a mysterious armored train, adorned with a distinctive yellow stripe, and shepherds its occupants in dark sedans through the smoggy streets of Beijing. Visitors are ushered away from nearby the city’s historic Tiananmen Square, and also from around Diaoyutai State Guesthouse, which has been frequented by North Korean officials. Someone very special had come to the Chinese capital this week.

The arrival of Kim Jong Un, North Korea’s Supreme Leader, in Beijing is historic in many respects. It is the first known foreign visit by Kim Jong Un since he ascended to the leadership of the Hermit Kingdom in 2011. His meeting with Chinese President Xi Jinping marked his first encounter with another head of state.

Kim’s arrival, first reported by Japanese media and later confirmed by Chinese state media, comes as the Swiss-educated 34-year-old prepares for historic summits with South Korean President Moon Jae-in in April and U.S. President Donald Trump in May to discuss denuclearization.

Read more: Dealmaker Donald Trump Faces the Ultimate Test Meeting Kim Jong Un

Kim has tested dozens of missiles and his nation’s sixth nuclear device in the last year alone. His latest Hwasong-15 intercontinental ballistic missile (ICBM) flew 10 times higher than the international space station and is theoretically capable of devastating any American city. In his New Year’s address, Kim bragged that “the entire area of the U.S. mainland is within our nuclear strike range.”

Three new rounds of U.N. sanctions since Trump took office didn’t seem to have much effect. But then suddenly Kim has offered historic talks, saying via a South Korea official early March, “there is no reason… to have a nuclear program if military threats against the North are resolved and its regime is secure.”

Few predicted the turnaround. Some speculate that North Korea’s elites are feeling the bite of sanctions. Others say that Kim is genuinely afraid of a preemptive strike by the U.S., a prospect that has grown more menacing after the appointment of two more hawks to Trump’s inner circle: new (though as yet unconfirmed) Secretary of State Mike Pompeo and National Security Advisor John Bolton. Still others believe Kim smells an opportunity.

“It’s a move stemming from confidence after completing his nuclear weapons program — he’s seeking a deal,” a senior former North Korean official who defected to the South tells TIME. “He looks a lot more wild than his father or grandfather [former regime leaders Kim Il Sung and Kim Jong Il], but I have seen him grow as a politician since his inauguration. I’ve seen him grow as a strategic thinker.”

This picture released by North Korea's official Korean Central News Agency on Dec. 2, 2017 shows North Korean soldiers and residents holding a rally in Pyongyang. AFP/Getty Images

But a visit by Kim to Beijing first injects a new element of uncertainty. China is key to sanctions enforcement, given that 90% of North Korean trade passes over the same shared frontier where photos Monday evening showed that 21-carriage train trundling past the Chinese border city of Dandong. (The train appeared very similar to one that Kim’s father, Kim Jong Il, took to Beijing in 2011 and the younger Kim reportedly has a fear of flying.)

Owing to pressure from Trump, Beijing has been enforcing the sanctions comparatively strictly, slashing imports of North Korea coal and labor that form the regime’s main cash cow. But Beijing and Washington are only loosely aligned, and over the decades the Kim dynasty has been deft at exploiting the cracks between adversaries to further its goals.

“Both China and North Korea have incentives to meet,” says Daniel Pinkston, an East Asia expert at Troy University in South Korea. “Kim would want to address sanctions relief, economic cooperation, aid, loans. There’s not the same urgency about the nuclear issue in China as the U.S. views it.”

Read more: U.S. Ambassador to China Terry Branstad Talks to TIME

It’s too early to say that any meeting means a rapprochement between the historic allies, which have grown estranged over recent decades as China flourished under “reform and opening” while North Korea festered in impoverished isolation. Xi may just be signaling to Trump and Moon that he will not be sidelined in any negotiations to end North Korea’s nuclear program.

But if Kim is ready to make concessions, then the fractures among nearby nations may widen. South Korea simply wants a lower temperature on the peninsula. Washington wants to ensure its military bases in South Korea and Japan remain intact. China, however, doesn’t like American troops on its borders and is furious that South Korea hosts the American THAAD anti-missile defense system, which it believes is part of an U.S. strategy of containment. Plus, Trump has just launched tariffs on Chinese goods that may mark the first salvo of a trade war with Beijing.

With tensions between Beijing and Washington growing once again, if Kim is willing to make a deal, President Xi may be tempted to put his own interests before those of the capricious occupant of the White House.

After all, “the long-term Chinese objective is to dismantle the San Francisco treaty system,” says Pinkston, referring to the American-led East Asian alliances negotiated in 1951. “To get the U.S. out of Asia and to extend their hegemony in the region and put China in the driver’s seat in the security and economic realm.”

Get The Brief. Sign up to receive the top stories you need to know right now. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Write to Charlie Campbell at charlie.campbell@time.com.