North Korean leader Kim Jong Un was treated to a lavish welcome by Chinese President Xi Jinping during a secretive trip to Beijing as both sides seek to repair frayed ties ahead of landmark summits with Seoul and Washington.
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.
Also read: Kim's rare trip to China!
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 two men had not met since Kim took over after the death of his father, Kim Jong Il, in 2011, but Xi underscored the importance of developing ties, saying it was "a strategic choice and the only right choice," according to Xinhua.
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.
"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," Kim said, according to Xinhua.
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.
While Chinese officials refused to confirm Kim's presence, a heavy police presence at key venues, motorcades driven under police escort, and barricades in the city centre fuelled the belief that Kim had come to pay his respects.
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.