NORTH Korean leader Kim Jong Un has visited Beijing and met China’s President Xi Jinping in his first known trip to a foreign country since he took power in 2011.

The leaders sought to portray strong ties between the long-time allies despite a recent chill as both countries confirmed Kim’s secret trip this week.

The visit highlights Beijing and Pyongyang’s efforts to better position themselves by showing they support each other ahead of Kim’s planned meetings with South Korean President Moon Jae-in and US President Donald Trump in the coming weeks.

Kim made the unofficial visit to China from Sunday to Wednesday at Xi’s invitation.

Xi held talks with Kim at the Great Hall of the People in Beijing and he and his wife Peng Liyuan hosted a banquet for Kim and his wife Ri Sol Ju. They also watched an art performance together.

Official reports from both countries depicted warm ties between the two leaders in an effort to downplay recent tensions over Kim’s development of nuclear weapons and long-range missiles.

In these reports, “Kim reaffirms the traditional friendship between the two countries as if nothing had ever happened, when the relationship had plummeted to unprecedented lows”, said Bonnie Glaser, an Asia expert at the Centre for Strategic and International Studies.

Ties in recent months have frayed as China supported tougher UN sanctions on North Korea and suspended imports of coal, iron ore, seafood and textiles.

Pyongyang last year seemingly sought to humiliate Beijing by timing some of its missile tests for major global summits in China, while its state media accused Chinese state-controlled media of “going under the armpit of the US” by criticising the North.

Xi hailed Kim’s visit as embodying the importance with which the North Korean leader regarded ties with China.

“We speak highly of this visit,” Xi told Kim, according to a state news agency.

For China, the visit also reminds other countries that Beijing remains one of North Korea’s most important allies and is a player not to be sidelined in denuclearisation talks.

It also projects to the Chinese public that Xi is firmly in charge of steering Beijing’s relations with North Korea in a way that favours China’s interests.

“Here is Xi Jinping saying, ‘Don’t worry, everything is going to be great’,” Glaser said.

Trump tweeted that he had received a message from Xi saying that his meeting with Kim “went very well” and that Kim “looks forward to his meeting with me”.

“For years and through many administrations, everyone said that peace and the denuclearisation of the Korean Peninsula was not even a small possibility,” he tweeted.

“Now there is a good chance that Kim Jong Un will do what is right for his people and for humanity. Look forward to our meeting!”

Analysts say Kim would have felt a need to consult with his country’s traditional ally ahead of summits with Moon and Trump. China would also not want Kim’s first foreign meeting to be with someone other than Xi.

Kim was described as saying that his country wants to transform ties with South Korea into “a relationship of reconciliation and co-operation”.

North Korean state media published Kim’s personal letter to Xi, where he expressed gratitude to the Chinese leadership for showing what he described as “heartwarming hospitality” during his “productive” visit.

Kim also asked Xi to visit North Korea at a time convenient for him, which Xi “gladly accepted”.