- Kim Jong Un visited China with his wife Ri Sol Ju, Xinhua said
- He said that his country is committed to denuclearisation
- Kim had not met Xi since he took over after death of his father in 2011
On his first trip abroad since taking power, Kim and his wife were met with honour guards and a banquet hosted by Xi, according to state media, which confirmed the visit on Wednesday only after Kim had returned to North Korea.
The two men held talks at the imposing Great Hall of the People during which they hailed their nations' historic relations, with Kim pledging that he was "committed to the denuclearisation" of the Korean peninsula, according to China's Xinhua news agency.
"There is no question that my first foreign visit would be to the Chinese capital," Kim said, according to North Korea's official KCNA news agency.
"This is my solemn duty as someone who should value and continue the DPRK-PRC relations through generations."
KCNA said Xi accepted an invitation to visit Pyongyang, which would be his first trip to the North Korean capital since he took power in 2012.
The Chinese leader said he was willing to maintain frequent contact with Kim "under the new circumstances".
Xi and Kim, flanked by officials, sat across from each other at a long conference table at the Great Hall of the People, according to television images which showed the North Korean leader taking meticulous notes.
Later, Xi and his wife, Peng Liyuan, waved goodbye while Kim and his spouse, Ri Sol Ju, smiled as they left in a black car.
Analysts said Xi likely wanted to see Kim to ensure North Korea does not cut a deal with US President Donald Trump that hurts Chinese interests during a summit that is expected to be held in May.
Beijing had appeared sidelined by Pyongyang's approaches to Seoul and Washington, but Kim's visit puts China firmly back at the centre of the diplomatic game.
"It shows that at this crucial juncture, Kim and Xi believed that it was time to seize the opportunity to consult," Bonnie Glaser, a China expert at the Washington-based Center for Strategic and International Studies, told AFP.
"Both likely concluded that further deterioration in relations would be harmful."
Deng Yuwen, an independent Chinese international relations scholar, said that North Korea needed to turn to its old ally ahead of the US summit, as Kim will be sceptical that Trump will guarantee the security of his regime.
"North Korea needs the big brother to protect it at a crucial moment," Deng said.
Xinhua said Kim expressed his willingness to hold summits with Trump and South Korean President Moon Jae-in.
South Korea said last month after talks with Kim in Pyongyang that he would consider abandoning his nuclear weapons in exchange for US security guarantees, and flagged a halt to all missile and nuclear tests while talks were under way.
White House spokeswoman Sarah Sanders said Trump received a personal note from Xi about Kim's visit on Tuesday.
"We see this development as further evidence that our campaign of maximum pressure is creating the appropriate atmosphere for dialogue with North Korea," Sanders said.
Confirmation of the visit ended 24 hours of speculation about the identity of a mysterious North Korean visitor after Japanese media spotted a green train, similar to the one used by Kim's father, arriving in Beijing on Monday and departing the following day.
His visit to China, which KCNA said ran from Sunday to Wednesday, came as a surprise given the state of relations between the Cold War-era allies, which fought together in the 1950-53 Korean War.
China chaired six-party talks on North Korea that collapsed a decade ago, but its call to revive that forum have not been heeded so far and it appeared to be on the margins when South Korea announced that Kim had offered to meet with Moon and Trump.
Frustrated by its neighbour's nuclear weapons programme and under pressure from Trump, China has backed a raft of UN sanctions, using its economic leverage to squeeze Kim's regime.
At the same time, Beijing fears the collapse of the regime in Pyongyang and the instability it would bring, potentially sending waves of refugees into China and the possibility of US troops stationed on its border in a unified Korea.
The tensions prompted North Korea's official news agency to issue a rare critique of China last year, warning of "grave consequences" if Pyongyang's patience was tested further.
But Kim's visit appears to have put relations appear back on track, with Xi inviting Kim and his wife to visit China again.
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.