A secretive meeting between North Korea's Kim Jong Un and China's Xi Jinping this week showcased enduring bonds between the two countries, highlighting the diplomatic challenge facing US President Donald Trump.
Kim, making what was believed to be his first foreign trip as leader, arrived in Beijing aboard a slow armoured train and met with Xi and other senior Chinese officials, according to North Korean and Chinese media.
The "unofficial" visit, which was not announced until after Kim left China, came just weeks before the North Korean leader is scheduled to see South Korea President Moon Jae In, followed by a planned summit with Trump.
The Beijing meeting, analysts said, was staged to show that North Korea-China ties are back on track, as underscored by photographs of energetic handshakes and an account of a heartfelt toast from Kim.
The message to the United States: Any moves on North Korea must go through Xi.
Trump showcased China's gatekeeper role in a tweet today, saying Xi told him that plans for a US-North Korea summit appear on track.
"Received message last night from XI JINPING of China that his meeting with KIM JONG UN went very well and that KIM looks forward to his meeting with me," Trump wrote. "In the meantime, and unfortunately, maximum sanctions and pressure must be maintained at all cost!"
"Beijing is reasserting itself and looking to shape the agenda for the upcoming summits," said Adam Mount, a senior fellow and director of the Defence Posture Project at the Federation of American Scientists.
"Divisions between Beijing and Pyongyang were a major asset to Trump's pressure campaign," he said.
Reinforcing their ties would weaken "Trump's hand in negotiations and diminish further the effectiveness of US military threats," Mount added.
Ni Lexiong, a military expert at the Shanghai University of Political Science and Law, said Kim was using conflict between China and the United States to "obtain benefits from both sides."
In international press coverage, Kim is often portrayed as an irrational madman, more of a punchline than a person, let alone a leader. Trump has referred to him as "little rocket man" in tweets.
Kim's diplomatic debut will make it harder to dismiss him outright, experts said.
"We're seeing a carefully crafted North Korean strategy on diplomacy unfold on the world stage, starting with Beijing," Jean H. Lee, a North Korea expert and fellow at the Wilson Centre in Washington, said.
"Shutting China out and ramping up the rhetoric with the United States gave [Kim] the space and justification he needed to expedite the building of nuclear bombs and ballistic missiles," she wrote.
"Now, with a program he feels confident is a proven threat, he feels emboldened to force the region's leaders to treat him as an equal, not as the young son of a dictator who inherited power."
China's Xi may take issue with "equal." There have been few signs that Xi is fond of Kim.
Only two years into his reign, Kim had his uncle, who was North Korea's main liaison with China, executed for building his own power base.
Then, in 2016, as Xi was hosting a Group of 20 summit on his home turf, Kim presided over the launch of three medium-range ballistic missiles, stealing the spotlight. The South Korean military called the move an act of "armed protest" against Xi.
When Xi sent a top official to Pyongyang last year, Kim did not even see him.
Successive American administrations have called on China to use its economic leverage over North Korea to exert control. But analysts say that China's main priority has always been stability, and it does not want to do anything that could cause the collapse of the Kim regime, which could bring millions of hungry refugees - and, it fears, US troops - to its door.
Amid increasing talk of military options from the Trump Administration, China seemed more willing to act. It has been more carefully enforcing sanctions, conducting intrusive inspections of cargo and cutting off key North Korean exports, including seafood and workers, for instance.
Those efforts helped bring Kim back to the table. "Amid the tightened sanctions, rapprochement with China has become a practical need of great urgency for North Korea," said Cheong Seong Chang, an expert on North Korea's leadership at the Sejong Institute near Seoul.
In the short term, experts see the meeting as a sign that the Trump summit will likely go ahead. Kim can now enter those talks with more confidence.
"The visit is a breakthrough of the diplomatic isolation imposed on North Korea," said Cai Jian, executive director of the Centre for Korean Studies at Shanghai's Fundan University.
Having shaken hands with Xi, young Kim heads into the negotiating room with "more useful bargaining chips, or a more advantageous position to negotiate with the West."