Hong Kong (CNN) More than 15 months after Kim Jong Un traveled to Beijing and invited the Chinese President to visit Pyongyang, Xi Jinping has arrived in the North Korean capital for a two-day state visit this week.

"The friendship between China and (North Korea) conforms to the wishes of people from both countries," Xi said, according to Chinese state media.

He added that that maintaining the relations is an "unshakable policy" of the Chinese Communist party and the government.

This is the first visit by a Chinese leader to North Korea in 14 years, and analysts say the timing is no coincidence. Next week will see Xi and the leaders of the United States, Russia and South Korea all travel to Japan for the G20.

US President Donald Trump has announced plans to meet Xi on the sidelines of that summit , where the two will likely discuss the ongoing trade war and negotiations with North Korea, which have been at a standstill since Trump and Kim's last summit in Hanoi ended abruptly without a deal.

Though Trump says he's in "no rush" to reach an agreement with Kim to cement one of his signature foreign policy goals, the clock is ticking. Kim said in an important policy speech in April that he will give the US until the end of the year to show more flexibility in the nuclear talks, and Trump has begun gearing up for the 2020 election which could see him leave office.

Kim sent a letter to Trump earlier this month, the arrival of which appears to have prompted Tump to take a more optimistic stance on the possibility of future talks.

"I think something will happen that's going to be very positive," said Trump, who reiterated that the two men had a "very good relationship."

Xi, it appears then, is attempting to make sure China's role is secure in what has become a sort-of diplomatic love triangle between the three countries.

"Xi is making clear that China is a key player that cannot be left out of decisions regarding security in Asia," said Daniel Russel, a former assistant secretary of state for East Asian and Pacific Affairs during the Obama administration and current vice president of the Asia Society Policy Institute.

While the US-China trade war is likely the most pressing issue for Trump and Xi to settle, Russel said, Xi's visit is "a clear reminder to Trump that China can be a helper, or play the spoiler, in the effort to end North Korea's nuclear threat."

For Kim, the visit provides an important propaganda opportunity, said Laura Rosenberger, a former US diplomat and current director of the Alliance for Securing Democracy.

"(It's) real ammunition for Kim Jong Un to be able to show his people, once again, just how powerful he is on the world stage," said Rosenberger. "This doesn't happen very often. It's a state visit. It's quite significant."

A photograph from North Korea's official Korean Central News Agency (KCNA) released on March 28, 2018 shows China's President Xi Jinping (right) shaking hands with North Korean leader Kim Jong Un in Beijing.

Rocky years

North Korea and China are longtime allies dating back to the Korean War, and Beijing remains Pyongyang's biggest international benefactor, accounting for an estimated 90% of North Korean foreign trade. That assistance is believed to keep the North Korean economy afloat.

But no Chinese leader has visited the country since North Korea began testing nuclear weapons in 2006 and China has voted in favor of UN Security Council resolutions punishing Pyongyang for those tests.

After Kim Jong Un took power in 2011, he proceeded to purge several high-ranking officials believed to be close to Beijing from Pyongyang's ranks, including his uncle Jang Song Thaek. Kim then ramped up North Korea's testing and development of nuclear weapons and ballistic missiles in open defiance of China's wishes.

"The Chinese were deeply concerned that they were losing influence in North Korea, that somehow Pyongyang was drifting out of Beijing's orbit," said Evans Revere, a former assistant secretary of state for East Asia and the Pacific during the Clinton Administration.

When Kim began to pursue diplomacy in early 2018 -- starting with the Winter Olympics detente -- improved relations between China and North Korea became an important priority for both sides.

Kim has visited China four times to date, and with each trip both Pyongyang and Beijing have lauded the historic relationship the two countries share, ignoring the rocky recent years.

In this Jan. 8 photo provided by the North Korean government, North Korean leader Kim Jong Un, left, and Chinese President Xi Jinping pose for photographs at the Great Hall of the People in Beijing.

In a rare opinion piece published in North Korea's state-run Rodong Sinmun newspaper, Xi said he will be visiting North Korea "with the beautiful hope of engraving a new chapter by inheriting the friendship" of the two countries.

This year marks the 70th anniversary of official diplomatic relations between the People's Republic of China and the Democratic People's Republic of Korea, as both countries are officially known.

Had Xi not made a trip to North Korea this year, it may have been construed as an insult, said Revere.

Though Revere said he didn't see the North Korea issue being used as a card in trade negotiations -- China maintains the two are separate issues and should be treated as such -- he added "there is a bit of gamesmanship behind this."

"I think clearly there's a message being sent to the United States: That before we meet with you, we're going to meet with our North Korean ally and partner," he said.