As a signpost along the course of history, there is no ritual more pregnant with uncertainty than the handshake portrait. At some points, it has proved to be a marker of renewal: Robert E. Lee surrendering to Ulysses S. Grant at Appomattox Court House, in 1865. At others, it has been the prelude to disaster: a smiling Neville Chamberlain extending his hand to Adolf Hitler, in 1938. The medium and the wardrobe change, but the essential dynamic stays the same: powerful, sometimes villainous, figures balancing the weight of self-interest, dignity, and mutual suspicion. When the history of Asia in the twenty-first century is written, the portrait of Kim Jong Un’s surprise encounter with Xi Jinping this week may take its place in the pantheon. Kim had not left the country or met with another head of state since coming to power, more than six years ago. Despite relying on China for trade and weapons, he had flouted Beijing’s entreaties to drop his nuclear program and had even gone so far as to test missiles on days when Xi was trying to host solemn occasions, a gesture that seemed either calculated or unconcerned with Xi’s embarrassment.

But, on Sunday, Kim secretly boarded his armored train and chugged across the border with China to meet the most powerful leader in Asia, a man whose decision-making about North Korea may well shape whether the recent, fragile steps toward negotiation end in peace or in recrimination. Kim and his wife, Ri Sol Ju, were treated to full pomp and ceremony, including an honor guard, a banquet, and talks with Xi at the Great Hall of the People. Among the photos of the leaders’ encounter, one portrait invites closer inspection: an outdoor grip-and-grin, in a classical Chinese courtyard of vermillion lacquer and gray brick.

Xi, a portly sixty-four, wears a tight, faintly irritated smile and a deep-navy Western business suit, the uniform favored by Chinese leaders in the forty years since they started opening, haltingly, to the world economy, without giving up the Communist Party’s monopoly on power—a hybrid model that China has tried in vain to persuade North Korea to adopt. By inviting Kim to China, Xi had to put aside his own pique and frustration in order to re-inject himself into a process of negotiation that was rapidly slipping out of China’s control. “Xi Jinping is not a leader who wants to sit back and wait and see what happens,” Bonnie Glaser, an Asia specialist at the Center for Strategic and International Studies, told me. “Having emerged as the twenty-first-century emperor of China, he is vulnerable on this issue, so he has to be proactive and not only try to get China back in the game as the ground begins to shift on the Korean Peninsula but also promote Chinese interests.”

Standing to Xi’s right, Kim, thirty years younger, is a man out of time, with a white-wall pompadour from the nineteen-fifties and a pinstripe outfit of no easy description, a broad-collared North Korean take on a Sun Yat-sen suit. (In Pyongyang, I once asked what to call that style of dress and was told, “We call it ‘a suit.’ ”) Kim is square to the camera, impassive, except for the gentlest trace of a smirk.

The North Korean crisis has morphed faster and more surprisingly in the first three months of 2018 than at any time since the death of Kim Jong Il, in 2011. Having spent much of the past two years taunting and defying the outside world, Kim, since New Year’s Day, has dispatched a delegation (including his sister) to the Winter Olympics in South Korea; pursued talks with President Moon Jae-in; received envoys in Pyongyang; proposed a summit with Donald Trump and a pause in his weapons-testing; and, most recently, agreed to Xi’s invitation to patch up tattered ties with China.

To Korea specialists in Seoul, Washington, and elsewhere, the motives behind Kim’s turn are opaque but important to divine. The optimistic view holds that, now that Kim has achieved a nuclear arsenal that puts the world on edge, he can turn his attention to economic growth, the other branch of his “byungjin” (or “parallel development”) policy. The details of Kim’s meetings with Xi are unknown, but the official Chinese report included a mention that “the DPRK’s socialist construction has also ushered in a new historical period. We are ready to make joint efforts with the DPRK side, conform to the trend of the times.” That could mean nothing, or it could be a sign that North Korea is preparing for larger economic reforms that would benefit from Chinese coöperation.

Pessimists call that reading naïve, arguing that Kim’s overtures are primarily intended to lure South Korea into shedding its reliance on American security and maneuvering the United States off the Korean Peninsula. For now, the most reliable analysis needs to permit both prospects, acknowledging that North Korea’s zigzagging may be the product of a strange alchemy of its own strategy and the uniquely unsettling effects of Trump’s threats.

“They’ve probably reached a point in their weapons program where they feel a pause is fine. They don’t need to test, and they could still advance and progress without these big demonstrations,” Victor Cha, a former director for Asian affairs in the National Security Council who is now a professor at Georgetown University, told me. “But the other piece of it is, I think, they’re feeling a lot of pressure from the sanctions. The last U.N. Security Council resolution basically sanctioned a hundred per cent of North Korea’s external trade. So this is unprecedented. And then the other thing is, I think, they are worried that the U.S. might do something crazy. I think they are genuinely worried about that.”

Whatever the precise parameters of Kim’s motivation, his China play has made it more difficult for Trump, who would have preferred that Beijing remain at odds with Pyongyang. Kim and Xi have re-scrambled the perceived loyalties and suspicions that will shape any potential encounter between North Korea and the United States—at the negotiating table or on the battlefield. This game is in the early stage. There may yet be more handshakes to come.