BEIJING (AP) -- With smiles and firm handshakes, North Korea and China used a surprise summit this week to show that despite recent tensions, Pyongyang still has a powerful backer and Beijing will not be sidelined in discussions about the fate of its unpredictable neighbor.
North Korean leader Kim Jong Un's secretive talks with Chinese President Xi Jinping in Beijing appear aimed at improving both countries' positions ahead of Kim's anticipated meetings with South Korean President Moon Jae-in and President Donald Trump in the coming weeks.
A key objective for Beijing is to reassert its relevance to the talks, from which it has been excluded. China has appeared increasingly shut out as its relations with the North deteriorated and Pyongyang reached out to Seoul and Washington.
"Kim Jong Un's visit shows that China is not marginalized, but playing a leading role. This saves China a lot of face," said Pang Zhongying, a North Korea expert at Renmin University in Beijing.
"North Korea once again is taking advantage of China," Pang said. "It plays the China card, showing South Korea and the U.S.: China is still my ally."
Official reports from both countries on Wednesday depicted in effusive terms warm ties between the leaders in an effort to downplay recent tensions over Kim's development of nuclear weapons and long-range missiles.
In the reports, "Kim reaffirms the traditional friendship between the two countries as if nothing had ever happened, when the relationship had plummeted to unprecedented lows," said Bonnie Glaser, an Asia expert at the Center for Strategic and International Studies.
Ties in recent months have frayed as China supported tougher U.N. sanctions on North Korea and suspended coal and iron ore imports. Pyongyang last year seemingly sought to humiliate Beijing by timing some of its missile tests for major global summits in China.
Kim made the visit to China at Xi's invitation, China's official Xinhua News Agency said, in his first trip to a foreign country since he took power in 2011. Xinhua said the trip ran from Sunday to Wednesday but appeared to include travel time from Pyongyang on the special armored train that Kim traveled in, which secretly arrived in Beijing on Monday and left Tuesday afternoon.
Rumors of Kim's presence began circulating on Monday night, with the spotting of his special train, Chinese security teams and official delegations at the border city of Dandong and various points in Beijing.
Although China sought to keep Kim's visit secret, and Wednesday described it as "unofficial," it accorded him full honors due to a head of state, including a formal welcoming ceremony and troop review at the Great Hall of the People in central Beijing.
Xi and his wife, Peng Liyuan, also hosted a banquet for Kim and his wife, Ri Sol Ju, and they watched an art performance together, Xinhua said.
"We speak highly of this visit," Xi told Kim, according to Xinhua.
For China, the visit also projects to its public that Xi is firmly in charge of steering Beijing's relations with North Korea in a way that favors China's interests.
"Here is Xi Jinping saying, 'Don't worry, everything is going to be great,'" Glaser said.
Analysts say Kim would have felt a need to consult with China ahead of summits with Moon and Trump. His famously reclusive father, Kim Jong Il, made his first visit to China as North Korean leader in May 2000, reportedly to consult with the Chinese leadership ahead of his summit with South Korea's then-leader, Kim Dae-jung.
China would also not want Kim's first foreign meeting to be with someone other than Xi.
"This is China asserting its regional hegemony and influence, saying, 'Hey, you talk to me first,'" said Michael Kovrig, senior adviser for Northeast Asia at the International Crisis Group.
In footage aired by China's state broadcaster China Central Television, Kim appeared reserved and collected as he sat at a long table across from Xi. Kim wore horn-rimmed glasses and was shown jotting down notes and speaking in a calm manner. In contrast, while meeting with South Korean envoys earlier this month, Kim was shown by his state media frequently smiling, bursting into laughter, proposing toasts and waving at departing limousines.
Kim was described by Xinhua as saying that his country wants "reconciliation and cooperation" with South Korea, with which it is technically still at war. He also said North Korea is willing to hold a summit with the United States, according to Xinhua.
North Korean state media, however, didn't carry Kim's comment about his plans to talk with the United States. The North has yet to officially confirm its interest in a summit between Kim and Trump.
North Korea's official Korean Central News Agency published Kim's personal letter to Xi, dated on Wednesday, in which he said he was satisfied that the leaders confirmed their "unified opinions" on mutual issues.
Kim also called for more meetings with Xi and other Chinese officials and asked Xi to visit North Korea at a time convenient for him, to which Xi "gladly accepted," KCNA said.
"For the North Koreans, it is in their best interests to enter any meetings with Moon or Trump having shored up and repaired to a certain extent their relations with Beijing," said Paul Haenle, director of the Carnegie-Tsinghua Center for Global Policy in Beijing.
The North's diplomatic outreach this year follows a tense 2017 when it conducted its most powerful nuclear test to date and tested three intercontinental ballistic missiles designed to target the U.S. mainland.
The developments are being interpreted as the North being desperate to break out of isolation and improve its economy after being squeezed by heavy sanctions. Analysts think Kim may have been seeking promises from Beijing that it wouldn't hit the North too hard with sanctions if the talks with Washington and Seoul fall apart and the North starts testing nuclear weapons and missiles again.
"At least one of the things that Kim would want out of these meetings is a way forward to begin to ease those sanctions and support from China in that effort," said Glaser, the Asia expert.
China remains North Korea's only major ally and chief provider of energy, aid and trade that keep the country's broken economy afloat.
In addition to the trip being his first abroad as leader, Kim's talk with Xi was his first meeting with a foreign head of state. Kim's father had visited China several times during his rule, lastly in May 2011, months before his death that December.
"It's most proper that my first overseas trip would be the capital of the People's Republic of China," Kim Jong Un said, according to the North's KCNA. "It's also one of my noble duties to value the North Korea-China friendship as I do my own life."