After days of speculation, it has been confirmed that North Korea's leader Kim Jong-un did pay a visit to Beijing.
The visit, confirmed by China and North Korea, was Mr Kim's first known foreign trip since taking office in 2011.
He held "successful talks" with President Xi Jinping, 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 late 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.
What did the two leaders discuss?
Mr Kim arrived with his wife, Ri Sol-ju, by train on Sunday and left Beijing on Tuesday afternoon, according to reports.
During the visit, Mr Kim assured his Chinese counterpart he was committed to giving up his nuclear weapons, Xinhua 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.
The North's conditions include the removal of a US nuclear guarantee for South Korea, observers say.
North Korea's KCNA news agency called the visit "a milestone" in improving bilateral ties.
Mr Kim's arrival and departure were shrouded in secrecy. China said the visit was "unofficial" - so there was no announcement of it in advance, prompting speculation about who was on the train when it was spotted arriving.
Because of the visit's "unofficial" status, some of the normal protocols were not observed. For example no North Korean country flags were hung around the Great Hall of the People on Tiananmen Square.
But it had most of the other trappings of a state visit, including an honour guard and banquet in the Great Hall.
Could peace moves be derailed?
Despite the progress in recent months, a number of factors could affect the chances of success.
Kim Jong-un may have told the Chinese and the South Koreans that he is willing to abandon nuclear weapons, but of course that comes with conditions, and there are also reports from North Korea that could undermine that stance.
Satellite images from last month, published by the New York Times, show what looks like a new nuclear reactor ready to go online and the newspaper claims it could produce 20kg of weapons-grade plutonium each year.
What Mr Kim might want in return remains unclear. But both North Korea and China have long wanted US troops and weapons out of South Korea, and this is likely to be a key bargaining chip.
While Mr Kim has been in Beijing, US and South Korean troops are gearing up for annual military drills which the North has historically seen as provocation. They start on Monday.
Why is Kim's visit significant?
It's the latest in a flurry of diplomatic activity since the start of the year sparked by the Winter Olympics in South Korea.
Relations between North Korea and China, historically strong, had been deteriorating, with China backing US moves to tighten international sanctions in response to the North's growing nuclear threat.
But China, a military giant over the border, is still responsible for virtually all of North Korea's food and fuel aid.
It has largely been an observer of the recent diplomatic moves by Pyongyang towards the US and South Korea.
"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.
The 'bizarre logic' of the North's stance
Stephen McDonell, BBC News, Beijing
The comments China's media attributed to both leaders are pretty illuminating if true.
Mr Kim reportedly told Mr Xi that because "the situation is developing rapidly" he felt he should come to Beijing in person "out of comradeship and moral responsibility".
Given how tense relations have been recently, following China's imposition of tough economic sanctions, it's significant that Kim made Beijing his first foreign trip, before his planned meetings with Moon and Trump.
Crucially, Xi reportedly said China "sticks to the goal of denuclearisation of the peninsula" and Kim responded: "It is our consistent stand to be committed to denuclearisation."
This may sound bizarre, but there is logic there. They would argue that if they felt sufficiently secure there would be no need for such weapons.
The fact that Kim is on the record saying this in Beijing in front of Xi may show that the North Koreans are paving the way for a face-saving nuclear disarmament.
How does the US view the meeting?
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.
He said on Wednesday that he is "looking forward" to the meeting.
Received message last night from XI JINPING of China that his meeting with KIM JONG UN went very well and that KIM looks forward to his meeting with me. In the meantime, and unfortunately, maximum sanctions and pressure must be maintained at all cost!— Donald J. Trump (@realDonaldTrump) March 28, 2018