Hong Kong CNN  — 

A surprise visit by North Korean leader Kim Jong Un to China may indicate Pyongyang’s need for support from its closest ally ahead of upcoming summits with South Korea and the US.

Kim met with Chinese President Xi Jinping and other high ranking officials in Beijing this week. Observers had said it would have been highly unusual for him to meet US President Donald Trump without seeing Xi first.

Prior to the Beijing trip, Kim had never met a foreign leader since he took power in 2011. China is North Korea’s number one trading and economic partner, and is Pyongyang’s only major military ally.

Kim and South Korean President Moon Jae-in are due to meet next month, and a proposed meeting with Trump is due to take place by May. Aidan Foster-Carter, an honorary senior research fellow at Leeds University, said it would have been almost unthinkable for Kim to meet with Moon and Trump having never met Xi, given the importance of the Sino-Korean alliance.

Key alliance

Since North and South Korea reopened diplomatic ties in February, Pyongyang has been pushing for a Korean solution to the ongoing crisis on the peninsula, which analysts say is a way of driving a wedge between Seoul and Washington.

But recent moves have also left China, North Korea’s most important ally, somewhat marginalized.

The two countries have been allies since the Korean War, when Mao Zedong sent troops to support Kim’s grandfather Kim Il Sung, and still maintain a mutual defense treaty, under which they pledge to “immediately render military and other assistance by all means at its disposal” in the event of war or foreign attack.

Since Kim Jong Un took power in 2011 however, the relationship has become increasingly strained. Kim purged several key officials with close ties to Beijing, including his uncle, Jang Song Thaek.

He also angered China by pursuing missile and nuclear testing against Beijing’s stated goal of a denuclearized Korean Peninsula.

“The North Korean Chinese relationship has not been very good in recent years, particularly over China’s acceptance of international sanctions and degree of implementing thecm,” said James Hoare, an associate fellow at Chatham House and former UK diplomat in North Korea. “These will be subjects the North Koreans are keen to talk about.”

Foster-Carter agreed, adding Pyongyang may be hoping China will ease up on sanctions following the summits with South Korea and the US.

Tong Zhao, a North Korea expert at the Carnegie Tsinghua Center for Global Policy in Beijing, said Pyongyang “wants to have some insurance against this upcoming summit meeting with President Trump.”

“They know the meeting is very important but also very risky, there are a lot of uncertainties,” he said. “If the meeting fails the US could declare that diplomacy has failed and shift to a more coercive approach or even a military strike.”

“A stable and positive relationship with China would prevent the US from launching a military strike,” Zhao said.

There was high security in parts of Beijing where North Korean officials are believed to be visiting.

Difficult diplomacy

China has repeatedly emphasized that it supports a denuclearized Korean Peninsula, and has suggested a freeze-for-freeze solution to the current crisis, whereby the US and South Korea suspend joint military drills in return for North Korea suspending weapons testing.

“China would like to be seen as the ultimate peacemaker in the region,” said Adam Cathcart, an expert on Sino-Korean relations at the University of Leeds. “The Chinese would like a win.”

Zhao said Beijing is far more willing than the US to tolerate a nuclear North Korea, at least in the short term.

“China has long accepted the status quo,” he said. “It is prepared to deal with the nuclear reality and work on incremental progress towards disarming North Korea.”

Multiple analysts said the US may find itself outflanked if North Korea proposed a Chinese-backed freeze-for-freeze, or similar first step towards denuclearization.

“The US has rather got itself into a bind with its impossible demand for the total elimination of North Korea’s nuclear weapons,” Hoare said.

“The North Koreans might agree to halt their present programs, both missile and nuclear development, but I don’t think they’re going to go backwards – they see (the nuclear program) as essential to preserving their existence.”

North Korea expert Foster-Carter said “someone on either side has got to find a clever formula which suffices to convince the Americans that some kind of denuclearization process is on the table or beginning,” while still allowing North Korea to claim domestically that it has not sacrificed its deterrent capabilities.