North Korean leader Kim Jong Un has issued a veiled warning to President Trump with his surprise visit to China this week: He has other options for economic and diplomatic normalization if their rapprochement falters.

Kim and Trump are planning a follow-up meeting to their historic summit in Singapore in June. But there are misgivings on both sides about each other’s sincerity and commitment to improving their bilateral relations.

Against this backdrop, Kim, joined by his wife and an entourage of officials, arrived in Beijing on Tuesday for his fourth summit meeting with Chinese President Xi Jinping in less than a year. He will remain here through Thursday, making this the longest of his trips. 

It is the North Korean leader’s 35th birthday — a government spokesman declined to say whether there would be a party — but also the second day of talks between American and Chinese trade negotiators aimed at finding a way through their fractious trade war.

It was almost as if Kim and Xi had picked a date that would hammer home their messages to Trump most forcefully.”

Chinese Foreign Ministry spokesman Lu Kang said it was just a coincidence. China had a “wonderful and rich” diplomatic schedule, so it was inevitable that events would sometimes overlap, he said. “It’s very normal for us to maintain friendly exchanges,” Lu said. 

Xi has yet to visit North Korea. 

Analysts, however, saw a deeper significance in Kim’s arrival Tuesday.

 “Kim Jong Un is not feeling confident about his second summit with Donald Trump, so he is trying to court his Chinese counterpart,” said Zhao Tong of the Carnegie-Tsinghua Center in Beijing. “This sends a message to the U.S. that, even if the U.S. does not cooperate, even if they keep the economic sanctions, North Korea can still do well with China’s support.” 

The North Korean leader in fact said as much in his New Year’s Day speech last week.

“If the United States does not keep the promise it made in the eyes of the world and . . . attempts to unilaterally enforce something upon us and persists in imposing sanctions and pressure against our republic,” Kim said, “we may be compelled to find a new way for defending the sovereignty of the country.” 

The threat could be read two ways: that North Korea could return to aggressively developing its nuclear weapons program, or that it could find other countries to work with.

For his part, Xi appears eager to make progress to resolve the trade war between China and the United States. The dispute has been rumbling on for nine months, and during that period China’s economy has begun to slow sharply. Independent economists expect the growth rate to decelerate to about 6 percent this year, the slowest since 1990.

Reminding Trump that he can be helpful when it comes to dealing with North Korea could be a way for Xi to broker a better trade deal, analysts said.

“This could undermine the United States’ coercive leverage over North Korea,” said Zhao of Carnegie-Tsinghua. “This would make the U.S. nervous. Washington would hate seeing China having a much closer relationship with North Korea and therefore having much greater regional influence.”

It was the American president who first made this connection. During the early days of the trade war, Trump repeatedly suggested that tariffs could be slapped on China if it did not do everything in its power to rein in its neighbor. More than 90 percent of North Korea’s trade goes to or through China, giving Xi enormous leverage over Kim.

North Korea has long resented China’s influence over it, and Kim had been trying to reduce its dependence on its much larger neighbor by diversifying markets within the constraints of the sanctions. But now China can prove helpful.

“The United States started this trade war and has been using every possible means to put China in a difficult situation and to contain China,” said Xuan Dongri, director of the Institute of Northeast Asia Studies at Yanbian University in northern China. “Against this background, it is useful for China to have a friend like North Korea when dealing with the United States.”

With preparations for Trump and Kim’s second summit proceeding, Kim’s visit could also be seen as preparation for the meeting with Trump, Xuan said. Kim visited Xi immediately before and after the June summit with Trump.

“As a young leader dealing with the United States alone, he needs a country like China to offer advice,” Xuan said. “After all, China deals with the United States all the time.”

There has been little progress on the vague agreement that Trump and Kim signed in Singapore, which called simply for the “complete denuclearization of the Korean Peninsula.”

North Korea has not taken any steps toward relinquishing any of its nuclear weapons or long-range missiles, insisting that it must be a step-by-step process. Both Beijing and Moscow have argued for rolling back the harshest sanctions, imposed as punishment for missile launches, because North Korea has not launched a missile since the end of 2017.

But the Trump administration says it will not lift any of the sanctions until North Korea has given up its weapons program.

The U.S. president said Sunday that the details for their second summit would be announced in “the not-too-distant future,” while Kim reiterated last week that he was “ready to meet the U.S. president again anytime.”

The Vietnamese capital, Hanoi, could be the next venue, according to South Korean media reports.

Kim, the third-generation leader of North Korea, did not venture outside the country during his first six years in power. Then, after declaring at the end of 2017 that his nuclear weapons program was complete, he embarked last year on an astonishing frenzy of diplomacy.

His first trip was to Beijing to meet Xi in March 2018. China is North Korea’s only real remaining ally, but for the first five years of his presidency, Xi made it clear he had no time for the young leader next door.

On the Chinese Internet, Kim was mocked as “Kim Fatty the Third” and treated like a badly behaved nephew to Xi, who is 65. On Tuesday, Liu Hong, deputy editor in chief of the state magazine Huanqiu, repeatedly called Kim by a term that means “post-’80s” — the Chinese version of “millennial.”

But Xi suddenly became more interested in North Korea when Kim started making plans to meet South Korean President Moon Jae-in and then Trump. The Chinese leader apparently did not want to be left out.

For years, dating back to when Kim’s grandfather and father were in power, China has tried to nudge North Korea down a path of economic reforms similar to the ones the Chinese visionary Deng Xiaoping began at the end of 1978.

But the Kims, afraid that opening North Korea to outside information would spell the end of their authoritarian dynasty, resisted. 

Some Chinese analysts are hopeful that this might be starting to change. Since returning from his summit with Trump, Kim has turned his attention almost entirely to developing North Korea’s decrepit economy.

That has prompted Wang Sheng, researcher at the Co-Innovation Center for Korean Peninsula Studies at Jilin University, to speculate that 2019 could be for North Korea what 1979 was for China.

Deng’s economic reforms really began in 1979, starting with the liberalization of agricultural production and greater autonomy for managers in China’s industrial sector. China also established diplomatic relations with the United States in 1979.

“Since then, over the past 40 years, China has achieved great things,” Wang said. “Likewise, North Korea also needs a safe and stable external environment for its development. North Korea has seen China’s achievements and learned from the experience.”

Liu Yang, Yuan Wang and Lyric Li in Beijing and Simon Denyer in Seoul contributed to this report.