After days of speculation, it has been confirmed that North Korea's leader Kim Jong-un has visited China.

The visit, confirmed by China and North Korea, was Mr Kim's first known foreign trip since taking office in 2011.

Mr Kim held "successful talks" with Chinese leader Xi Jinping in Beijing, China's Xinhua news agency reported.

China is North Korea's main economic ally and it was thought highly likely it would consult Beijing before planned summits with South Korea and the US.

Mr Kim is due to meet South Korean President Moon Jae-in in April, and US President Donald Trump in May.

The Beijing visit is considered a significant step in North Korea's preparation for the proposed talks.

During the visit, Mr Kim assured his Chinese counterpart he was committed to giving up his nuclear weapons, China's Xinhua news agency reported, but with conditions.

"The issue of denuclearisation of the Korean Peninsula can be resolved, if South Korea and the United States respond to our efforts with goodwill, create an atmosphere of peace and stability while taking progressive and synchronous measures for the realisation of peace," Mr Kim was reported saying.

Ties with Beijing

North Korea's KCNA news agency called the visit "a milestone" in improving bilateral ties with China.

"It makes sense for North Korea to explain their positions and co-ordinate with China, their most important partner," Andray Abrahamian, research fellow at Pacific Forum CSIS told the BBC.

"Relations have been extremely strained the last five years and China has been sidelined in the diplomacy of the last several months," he said.

"From Beijing's perspective, this is a visit that should have happened some time ago."

To some extent, this is a "symbolic visit of courtesy" to China, Fyodor Tertitskiy of North Korea monitoring site NK News said.

"They have two upcoming summits - one with Seoul and one with Washington - and they are probably interested in hearing the Chinese position as well."

KCNA also said Mr Xi had accepted an invitation to return the visit.

US credits 'maximum pressure' policy

Mr Kim arrived with his wife, Ri Sol Ju, on Sunday and left Beijing on Tuesday afternoon, according to reports.

The trip is the latest in a flurry of diplomatic activity in recent weeks after ties between North and South Korea began improving at the start of the year and during the Winter Olympics in South Korea.

China briefed the Trump administration on Tuesday on the visit, Washington confirmed.

"We see this development as further evidence that our campaign of maximum pressure is creating the appropriate atmosphere for dialogue with North Korea," White House press secretary Sarah Huckabee Sanders said.

Last month, Mr Trump accepted an unprecedented invitation to meet Mr Kim, after months of hostility and North Korean missile tests.

If the summit goes ahead, Mr Trump would become the first sitting US President to meet a North Korean leader.

Source: BBC