North Korea's Kim Jong Un has made his first ever foreign trip as leader to meet China's president, vowing he is "committed to denuclearisation" and willing to hold summits with the South and the US.
The secretive visit was confirmed Wednesday by Chinese and North Korean state media which said Kim was treated to a lavish stay in a show of unity after relations were battered by Beijing's support of UN sanctions against Pyongyang.
Kim had not met China's President Xi Jinping since taking over after the death of his father, Kim Jong Il, in 2011.
The young leader told Xi that he was ready to hold a summit with South Korean President Moon Jae-in as well as US President Donald Trump, according to China's Xinhua news agency.
"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.
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.
Analysts said Xi likely wanted to see Kim to ensure North Korea does not cut a deal with 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.
"They don't want to see a grand deal between the US and North Korea that suddenly makes them great friends," said Bill Bishop, publisher of the Sinocism China Newsletter.
But 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 told AFP.
And Trump's decision to draft in hawkish former UN ambassador John Bolton as his new national security advisor last week "will make Kim more vigilant," Deng said.
Confirmation of the visit ended 24 hours of speculation about the identity of the 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 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 the Chinese foreign ministry said at the time that Beijing was consistent in its support for "good neighbourly and friendly cooperation" with the North.
In November, Chinese envoy Song Tao became the first senior Chinese official to visit North Korea for more than a year, though he did not meet Kim.
On March 18, the Global Times published a friendlier editorial.
"A severe difference between Beijing and Pyongyang over nuclear issues is a reality, but it should not be the whole picture of ties between the two sides," the daily wrote.
"North Korea is a respectable country."
While Kim Jong Un and Moon are due to meet at the border truce village of Panmunjom, the venue for the North Korean leader's meeting with Trump has yet to be announced.
The Demilitarized Zone that divides the two Koreas is the most plausible locations for the Kim-Trump talks, but Beijing could serve as a more neutral location.
High-level inter-Korean talks are scheduled for Thursday to pave the way for the Moon-Kim meeting, and discussions have also begun for the Trump summit.