TOKYO -- Xi Jinping is now Kim Jong Un's most powerful bargaining chip as the North Korean leader points toward his meeting with U.S. President Donald Trump.
After months of displaying hostility toward the Chinese leader, including repeated nuclear and ballistic missile tests coinciding with key Chinese events, Kim, who serves as chairman of the Workers' Party of Korea, slipped into and out of China unannounced, adding one more twist in a series of dramatic diplomatic turns concerning the Korean Peninsula.
It was time to make up. But why?
Kim is thinking of his upcoming meeting with Trump. The summit is to mark the first time for North Korean and American leaders to talk face to face.
While Trump has agreed to meet Kim, the U.S. leader has been stacking his national security team with hawks, such as Secretary of State nominee Mike Pompeo and National Security Advisor John Bolton, previously described by North Korean state media as "human scum and bloodsucker."
If the U.S.-North Korea summit collapses over a disagreement over denuclearization, Trump's team could immediately return to flashing its war card.
"It is our consistent stand to be committed to denuclearization on the peninsula in accordance with the will of late President Kim Il Sung and late General Secretary Kim Jong Il," Kim was quoted as telling Xi during their talks, according to the Chinese side. Kim Il Sung is Kim's grandfather, and Kim Jong Il is his father.
When reporting about Kim's visit to Beijing, North Korea's state-run media outlets did not report Kim's denuclearization remark.
Kim's dangerous game of dangling denuclearization to squeeze concessions out of Trump could backfire if Trump perceives him as trying to find a way to keep his nuclear weapons. This is why Kim has turned to China.
Like Pyongyang, Beijing wants to prevent war in Northeast Asia, which could deliver a heavy blow to the Chinese economy, the world's second-largest, after the U.S., in terms of gross domestic product.
After maneuvering in such a way as to sideline Xi from the diplomatic game with the U.S., Kim now wants to bring Xi back to the table. Having Xi there would make Trump think twice about resorting to military action.
As for Xi, he needed to regain his position as the Korean Peninsula's perceived power broker, a standing that had escaped him when the two Koreas began talking to each other ahead of the Winter Olympics in Pyeongchang, South Korea.
Although the 64-year-old Chinese leader has recently set himself up to lead China for the rest of his life, Kim knew Xi had a weak point: diplomacy.
There is concern within the Chinese Communist Party that Xi's North Korea policy has gained close to nothing. Nodding to Trump's pleas to dial up the pressure on Pyongyang did not bring Beijing into the inner circle of decision-making. Instead, China got left out of the loop. The Korean situation had further gotten away from Xi when Kim's meeting with Trump was set up through South Korea, not China.
Xi was in panic mode. Kim knew that if he threw a bone, Xi would bite. When Kim made overtures, Xi was all too eager to agree.
In Beijing, Kim was happy to let Xi play the role of big brother.
Upon announcing the Kim visit, China Central Television showed footage of Xi lecturing the young visitor from Pyongyang, with Kim dutifully taking notes.
One development in particular showed how Kim allowed Xi to save face: China informed the Trump administration of Kim's visit before it notified the media early on the morning of March 28. Xi told Trump that Kim was very much looking forward to meeting the U.S. president.
It made Xi look like a key mediator between the U.S. and North Korea, just like South Korean President Moon Jae-in.
China also briefed the Moon administration before the official announcement. The news came as a surprise to Seoul, which was under the impression that Kim's younger sister, Kim Yo Jong, not Kim himself, was visiting China.
But it was clear Kim had the upper hand. North Korean media did not show its leader taking notes. Instead, it showed Xi offering a toast to Kim.
It also showed Xi and his wife, Peng Liyuan, providing Kim and his wife, Ri Sol Ju, an unusually lavish welcome despite the visit being an unofficial one.
In one clip during a 40-minute report on Korean Central Television about the visit, Chinese officials eagerly shook hands with Kim. Another clip showed a vast number of motorcycles protecting the North Korean leader as he arrived in the Chinese capital by train.
One Chinese source said the Xi-Kim talks have strengthened both leaders. While they gave Kim some China-size muscle, they gave Xi back his "North Korea card," which he can play if Korean Peninsula diplomacy moves too far in a direction he does not like.
This is why Xi was able to put aside Kim's offensive bluster toward China.
Outwardly, Trump has welcomed the Xi-Kim talks. But privately, he could be fuming. What might happen between now and the end of May, when the U.S.-North Korea summit is expected to take place, is anybody's guess.