The train used by North Korean leader Kim Jong Un departs from Beijing on Wednesday.
Beijing CNN  — 

North Korean leader Kim Jong Un departed Beijing Wednesday by train, marking an end to his surprise visit to the Chinese capital that comes as Washington and Pyongyang are trying to hammer out the details of a second summit.

Kim and his delegation are now expected to begin the 13-hour trip to the town of Dandong, which sits on the border between China and North Korea. Kim is expected to spend a total of four days in China, entering the country Monday and leaving early on Thursday.

The visit was Kim’s third to Beijing and fourth to China since March 2018, in what was his first trip outside North Korea since assuming power in 2011. He arrived in Beijing in his famed armored train early Tuesday morning and held meetings with Chinese President Xi Jinping.

China is North Korea’s only real ally internationally and is Pyongyang’s biggest trading partner by some margin.

Chinese Foreign Ministry spokesman Lu Kang would not comment on the purpose or timing of Kim’s visit at a briefing Tuesday, saying only that the two countries were making “joint efforts to uphold peace and stability on the Korean peninsula.”

An editorial in Global Times, a nationalist state-run Chinese tabloid, said Kim’s decision to visit China on his birthday illustrates just how close the two countries are and how vital China’s role is in ongoing denuclearization talks.

“We hope that the United States and South Korea can accurately understand that the development of good relations between China and North Korea is significant in pushing for the denuclearization of the (Korean) peninsula,” the piece read.

Analysts have speculated that Kim may be using the trip to both to shore up relations between Beijing and Pyongyang and remind the Trump administration that North Korea has potential diplomatic and economic partners beyond the United States and South Korea.

“It’s pretty clear he’s not putting all his eggs in one US basket because he has a bigger goal in mind – achieving prosperity, achieving inter-Korean peace and reunification but on Pyongyang’s terms, and engaging diplomatically with like-minded countries to show the world that Kim loves and promotes peace more than Trump,” said Duyeon Kim, an adjunct senior fellow at the Center for New American Security.

Kim Jong Un’s visit comes as the United States and China concluded high-level meetings in Beijing Wednesday to bring about an end to the trade war between the two countries, the first face-to-face meetings between the two sides since US President Donald Trump and Xi effectively called a truce in the trade war last month.

Experts believe that the young North Korean leader may see an opening if the relationship between Beijing and Washington continues to deteriorate.

In his annual New Year’s Day address, Kim appeared to affirm his commitment to denuclearization but warned of pursuing a “new way” if the United States continued to make unilateral demands in the negotiating process.

Meeting with Xi before Trump, offers the North Korean leader an opportunity to go over his game plan for the Trump summit with his Chinese counterpart, said Duyeon Kim.

“Beijing’s invisible hand is very visible even though Beijing doesn’t yet have a physical seat the at the summit table,” she said.

Analysts have also said that could mean leaning more on China at the expense of the United States or even attempt to play the two global superpowers off one another. Kim’s grandfather and North Korea’s founder, Kim Il Sung, pursued a similar strategy in dealing with China and the Soviet Union while the two countries were feuding.

However, US Secretary of State Mike Pompeo said the Chinese have told him that the two are “separate issues.”

CNN’s Eric Cheung and James Griffiths contributed to this report