China confirms North Korean leader Kim Jong Un visited Beijing

SHANGHAI/SEOUL, March 28 (Reuters) - North Korean leader Kim Jong Un visited China from Sunday to Wednesday on an unofficial visit, China's state news agency Xinhua reported on Wednesday.

The visit was Kim's first known journey abroad since he assumed power in 2011 and is believed by analysts to serve as preparation for upcoming summits with South Korea and the United States.

Beijing has traditionally been the closest ally of secretive and isolated North Korea, but ties have been frayed by North Korea's pursuit of nuclear weapons and China's backing of tough U.N. sanctions in response.

North Korean leader Kim Jong Un and Chinese President Xi Jinping

Xinhua published a photograph of Kim and Xi shaking hands in front of the flags of the two nations.

Speculation about a possible visit by Kim to Beijing was rife earlier this week after a train similar to the one used by Kim's father was seen in the Chinese capital, along with heavy security and a large motorcade.

South Korea's Yonhap news agency reported that Kim visited China from Sunday to Wednesday with his wife, Ri Sol Ju. It cited North Korea without elaborating.

Xi had accepted an invitation from Kim to visit North Korea, Yonhap said.

Improving ties between North Korea and China would be a positive sign before planned summits involving the two Koreas and the United States, a senior South Korean official said on Tuesday.

Kim Jong Un's father, Kim Jong Il, met then-president Jiang Zemin in China in 2000 before a summit between the two Koreas in June that year. That visit was seen at the time as reaffirmation of close ties with Beijing. (Reporting by David Stanway in SHANGHAI and Joyce Lee in SEOUL Writing by Lincoln Feast Editing by Paul Tait)