North Korea has ended a week of feverish speculation by finally confirming that its secretive leader Kim Jong-il has been in China.
Chinese TV showed Mr Kim (left) with President Hu Jintao
Mr Kim, whose overseas visits are usually announced once they are over, held talks with President Hu Jintao, North Korea's KCNA news agency said.
His visit to his closest ally raised hopes that stalled talks on North Korea's nuclear standoff could resume.
It also led to speculation Mr Kim was studying Chinese-style economic reform.
KCNA said Mr Kim visited China from 10-18 January on an unofficial visit as the guest of Mr Hu.
The two leaders agreed to press for a "negotiated peaceful solution" to the nuclear issue, through the mechanism of the stalled talks.
China's official media confirmed the visit, saying Mr Kim had visited Beijing and the provinces of Hubei and Guangdong.
Soon after Mr Kim left China on Wednesday, the chief US negotiator on North Korea made an unexpected trip to Beijing.
Christopher Hill was due to meet China's Vice Foreign Minister, Yang Jiechi.
There were several sightings of Mr Kim during his secret visit
There was speculation in the South Korean and Japanese media that Mr Hill could also be meeting the North's top nuclear negotiator, Kim Kye-gwan, during his visit.
He could also be discussing what Mr Kim's entourage had told the Chinese during their reported visit to Beijing on Tuesday.
On Wednesday morning, a train believed to be carrying Kim Jong-il crossed into North Korea from the Chinese border city of Dandong, South Korea's Yonhap news agency said.
Foreign media had earlier reported that Mr Kim travelled to the southern Chinese province of Guangdong and the booming city of Shenzhen.
Beijing has been under pressure from Washington to use its leverage as the North's main ally to persuade Pyongyang to return to the negotiating table to discuss its nuclear programme.
Six-nation talks on North Korea's nuclear agenda are currently stalled.
North Korea has vowed to stay away from further rounds of negotiations unless financial sanctions imposed by the US are lifted.
Washington imposed sanctions against Pyongyang because of alleged counterfeiting and other illicit monetary activities.
The participants in the six-party talks are North and South Korea, Japan, China, the US and Russia.