BEIJING — Chinese President Xi Jinping will visit Pyongyang on Thursday, marking a diplomatic victory for isolated North Korean leader Kim Jong Un after denuclearization talks with President Trump collapsed dramatically in February.

Xi’s visit will be the first trip by a Chinese leader to North Korea in 14 years, since Hu Jintao, Xi’s predecessor, met with Kim’s father, Kim Jong Il, in Pyongyang in 2005. China is North Korea’s strongest ally and the economic lifeline for a country hit by U.N. sanctions.

Xi’s visit, which comes at Kim’s invitation, will take place Thursday and Friday, state media in both countries reported simultaneously on Monday. 

It comes just before a Group of 20 summit in Japan, as well as Trump’s visit to South Korea at the end of this month. 

North Korean state media reported that Kim Jong Un oversaw the testing of a new type of tactical guided weapon on April 17. (Reuters)

Xi and Kim will meet at a time when both are locked in standoffs with Washington over trade and denuclearization, respectively. Before the trade war between the world’s two largest economic powers turned acrimonious in the past year, Trump said he was counting on Xi’s help to pressure Kim into abandoning his nuclear and missile programs, and some considered Monday’s announcement a sign that China’s will to impose those sanctions is waning.

But South Korea’s government welcomed the news as a sign that the dialogue and peace process over North Korea are resuming. The announcement of Xi’s visit builds on a sudden flurry of diplomatic activity related to North Korea, after months of inactivity and backsliding.

Last week, Trump announced that Kim had sent him a “beautiful letter,” breaking months of silence after the collapse of their summit in Hanoi in February. Then Kim sent his sister to the border village of Panmunjom to offer flowers and condolences for the death of a former South Korean first lady.

South Korean President Moon Jae-in also expressed hope while on a visit to Scandinavia last week that an inter-Korean summit, between himself and Kim, might be possible this month.

South Korea’s presidential Blue House said Monday that it had been closely consulting with China to make Xi’s visit happen at an early date, in the belief that this would advance the peace process.

“We expect this visit to contribute to the early resumption of talks for complete denuclearization and a permanent peace settlement on the Korean Peninsula,” spokeswoman Ko Min-jung said in a statement. 

After his scheduled North Korea trip, Xi could sit down with Trump at the G-20 summit later this month in Japan, but officials in both countries have not confirmed plans for a meeting.

South Korea’s Moon and China’s Xi have also “agreed in principle” to hold a summit of their own in Osaka, the Blue House said.

Chad O’Carroll, the chief executive of the Korea Risk Group, said Xi’s trip, combined with Kim’s letter to Trump, might increase the incentive for Trump to seek a short-notice meeting with the North Korean leader at Panmunjom, to restart their stalled dialogue.

“Recall it was a short-notice summit in May 2018 — between Moon Jae-in and Kim Jong Un — which put the Singapore summit back on track after Trump declared it canceled,” he said. “So, there is precedent of this format.”

But other experts said Xi’s trip could be read as a sign of growing Chinese impatience with sanctions and reluctance to maintain pressure on Washington’s behalf.

Xi has sought to project an image of his influence over Kim by holding four meetings with him in China in the past two years. On two occasions, they convened days before Kim met with Trump for talks.

But the three-way dynamic has altered, with the U.S.-China relationship souring significantly in the past six months and no resolution in sight to those countries’ sprawling conflicts over trade and technology.

Song Tao, a senior Chinese envoy and head of the Communist Party's International Liaison Department, told state media Monday that Xi’s visit would mark the 70th anniversary of China and North Korea establishing diplomatic relations.

Xi and Kim will visit the Sino-North Korean Friendship Tower in Pyongyang, Song said. That monument commemorates Chinese who fought alongside North Koreans against Americans during the Korean War.

The visit is “greatly significant to the relations between the countries and its future,” Song said.

Mintaro Oba, a former State Department diplomat, said Xi might have felt obliged to finally visit Pyongyang after making Kim come to him four times. But the visit also reflects the fact that North Korea generally has the upper hand over Washington in regional diplomacy, he added.

“Kim can feel fairly confident that China and Russia’s interest in peninsular stability, tensions with the United States and desire to remain a part of the diplomatic process will keep those countries acting largely in line with North Korean interests,” he said.

“That means we can count on continued regional support for North Korea’s phased approach to nuclear diplomacy and a weakening consensus behind sanctions enforcement.”

 But Leif-Eric Easley, an associate professor at Ewha Womans University in Seoul, said it is unlikely that Xi’s agreement to visit Pyongyang came free.

“Kim should show progress on economic reform and denuclearization,” he said. “In terms of protocol, China owes North Korea this visit. Its implications will be gauged by how soon afterward Xi meets with Trump and how long he waits to visit South Korea.”

Although Kim met with Russian President Vladimir Putin in Vladivostok in April, North Korea had otherwise spent months stonewalling efforts by officials in Seoul and Washington to restart the dialogue after the failed Hanoi meeting, and had signaled its displeasure about the breakdown of that summit by testing short-range ballistic missiles. 

Shortly after the announcement of Xi’s trip, a 1.3-magnitude earthquake, suspected to be an explosion, took place on the border city of Hunchun at 7:38 p.m., China’s official earthquake monitoring agency said on its verified social media account.

But experts said a mining accident, for example, could easily have caused a small tremor. 

Denyer reported from Seoul.