Image copyright AFP Image caption Mr Kim was greeted with a welcome ceremony at Beijing's Great Hall of the People

After his surprise visit to China, North Korean leader Kim Jong-un left with backing for a possible second summit with US President Donald Trump, state media said.

Mr Trump and Mr Kim first met last June, but progress over denuclearisation has since stalled.

Chinese President Xi Jinping said he hoped the two leaders "meet each other halfway", Xinhua news agency reported

China is the North's main ally and key trade partner.

Mr Xi said China supported North Korea and the US "holding summits and achieving results, and supports relevant parties resolving their respective legitimate concerns through dialogue".

He also said China would be ready to play a "positive and constructive role" towards maintaining peace and achieving denuclearisation on the Korean peninsula, reported Xinhua.

Mr Kim made what is believed to be his first official trip outside North Korea to China last year, even before meeting South Korea's President Moon and Mr Trump. The recent visit is Mr Kim's fourth to China in less than a year.

Image copyright Reuters Image caption A train believed to be carrying the North Korean leader departs Beijing Railway Station on Wednesday

During his three-day visit to China, Mr Kim and his wife Ri Sol-ju were welcomed by Mr Xi and his wife with a banquet and an art performance. He also visited a pharmaceutical plant specialising in Chinese medicine.

Mr Xi accepted an offer to visit North Korea, state media said. It is still unclear when this would take place.

'Concern' over denuclearisation

Mr Kim had said in his annual new year's speech in January that he remained committed to denuclearisation, but warned that he would change course if US sanctions remained.

According to North Korean's official KCNA agency China supported the North's position.

"Xi Jinping said that the legitimate issues raised by the DPRK are rightful demands and that he fully agrees that the DPRK's reasonable interests should be justly resolved," it said, using the official country name the Democratic People's Republic of Korea.

It is not clear when or where a possible second Kim-Trump summit would take place, though South Korean president Moon Jae-in has said it will happen "soon".

Mr Moon, who has over the past year played mediator between North Korea and the US, said at a news conference on Thursday that Seoul would cooperate with the US in resolving the issue of sanctions on North Korea.

Image copyright AFP Image caption Mr Trump and Mr Kim met in Singapore last year

There has been little progress made between the US and North Korea since the historic Singapore summit in June - the first ever meeting between a North Korean leader and a sitting US president.

Both parties signed a pledge at the time to denuclearise the Korean peninsula, though it was never made clear what this would entail.

Pyongyang wants Washington to lift the sanctions the United Nations imposes on the country because of its nuclear and missile programmes.

North Korea argues that the US needs to match the steps it has taken towards denuclearisation, namely dismantling a nuclear testing site and a key missile engine facility.