In the days leading up to Vladimir Putin ’s just-finished visit to China , speculation rippled through diplomatic circles that the Russian leader planned to tack on a trip to North Korea—a possibility that irritated Beijing, according to diplomats and other officials with knowledge of the matter.

Chinese leader Xi Jinping has felt growing unease as ties between Putin and North Korean leader Kim Jong Un —two of his most important but also most volatile international partners—have grown more intimate, the diplomats and officials said. A combined visit to China and North Korea by Putin could also have reinforced Western fears of a trilateral authoritarian axis , leaving Beijing diplomatically more isolated, they said.

To China’s relief, Putin didn’t head to Pyongyang straight from the northern Chinese city of Harbin, just some 460 miles away from the North Korean capital.

On Saturday, Putin’s spokesman Dmitry Peskov told Russia’s state news agency, TASS, that arrangements for a visit by the Kremlin leader to North Korea are progressing well. “Preparations for the visit are under way,” Peskov said. He didn’t announce a date for the planned trip.

It couldn’t be determined whether Beijing exerted any pressure on Moscow ahead of Putin’s meetings in China, his first foreign trip after starting a new term earlier this month. But the Chinese side has made clear to the Kremlin that Beijing’s preference is to develop bilateral ties, as opposed to more of a three-way alignment that Russia has previously floated.

“China is avoiding the optics of a trilateral cooperation among the three countries,” said Yun Sun, director of the China program at the Stimson Center, a Washington think tank. “The goal is to avoid being locked in by two unpredictable partners.”

Putin in September accepted an invitation from Kim to visit North Korea. An analyst from the Russian International Affairs Council think tank in Moscow, which has close ties to the Kremlin, wrote in a recent analysis that after the meeting with Xi, the Russian leader “will consider the possibility of visiting a number of other non-Western capitals,” including Pyongyang.

The diplomatic dance among the three countries, which share an interest in dulling the U.S.’s influence in the world, has grown more complicated as Kim has sought to reduce his country’s reliance on China—most dramatically by wooing Putin with public support and weapons for the Russian war effort.

Since Beijing and Moscow declared a “ no-limits friendship ” just weeks before Russia’s invasion of Ukraine in February 2022, China and Russia have built on a trade relationship that has become a lifeline to Putin in the face of Western sanctions. Washington and its European allies say China has helped Russia revive its military production by providing it with drone engines and other dual-use material—products Beijing labels as part of its “normal trade.”

Still, facing pressure from the Biden administration, Xi has refrained from offering weapons to Putin, according to U.S. and Ukrainian officials.

As the Russian war against Ukraine turns into a drawn-out conflict, Putin has instead turned to North Korea to help restock his depleted armory. Secretary of Defense Lloyd Austin told lawmakers earlier this month that North Korea’s munitions and missiles helped the Russians “get back up on their feet.”

Both countries have denied arms exchanges, including a rebuttal from Kim’s sister issued in state media on Friday.

Russia and North Korea have kept Beijing in the dark about what was discussed when Putin and Kim met for a rare summit in the fall , leading Chinese diplomats to ask their Western counterparts about what was agreed between the duo, according to people familiar with the matter.

Beijing worries that Russia might help China’s erratic neighbor build up its nuclear capabilities, the people said.

Russian analysts who follow Moscow’s relations with Pyongyang said Kim’s visit to Russia last year was a landmark event that allowed North Korea to overcome its foreign policy isolation and Russia to continue its pivot to the East.

“China is very worried about this new entente,” said Dennis Wilder, a former U.S. intelligence officer and now a fellow at Georgetown University.

Wilder noted that Beijing, while not willing to try to slow the Kim regime’s missile or satellite launches, has appeared to weigh in to persuade Pyongyang to hold back from conducting another nuclear test. “China wants a North Korea that presents a latent threat in Northeast Asia while maintaining the status quo,” he said.

Putin last visited Pyongyang in 2000 when he went for discussions with Kim’s father, Kim Jong Il , in a trip that was telegraphed by Moscow as demonstrating to the West the reluctance of the Kremlin to join the collective ostracizing of North Korea. On that trip, Putin traveled directly to Pyongyang from Beijing.

Analysts who follow Russian-North Korean relations say Kim has to tread carefully because he needs to preserve ammunition stocks for the defense of his own nation should there be an all-out war on the Korean Peninsula. But Kim is eager to have Putin in his corner, as a possible resource for improving his missile and nuclear programs, the analysts said.

“Broadly speaking they have immediate desires of each other,” Derek Grossman, a senior defense analyst at the global policy think tank and research institute Rand, said of Putin and Kim. “So it is, I think, a quid pro quo, if you want to look at it through the lens of the war in Ukraine and the lens of what North Korea wants to do vis-à-vis South Korea and Japan and the U.S.”

One reason why Xi didn’t want Putin to add Pyongyang to his itinerary following his trip to China lies with Beijing’s strategic intention to prevent China from being grouped into an axis that could deepen a demarcation in geopolitics—particularly in Northeast Asia, with China, Russia and North Korea on one side and Japan, South Korea and the U.S. on the other.

It is little secret in either Beijing or Pyongyang that the relationship between Xi and Kim is less trusting than the ties previous Chinese leaders had with Kim’s father, who was more intent on maintaining stability while challenging the West. The younger Kim since coming to power in 2011 has carried out more than triple the number of missile tests than his father and grandfather combined.

Those kinds of activities make China nervous because Beijing is eager to maintain the strategic buffer zone in North Korea in relation to South Korea, which is aligned with the U.S. and Japan. To do this, Beijing needs stability.

But Kim looks like he is more willing “to rock the boat” than his father, which worries Beijing, Rand’s Grossman said.

During Putin’s latest visit to China, he and Xi issued a joint statement with a relatively lengthy section accusing the U.S. of escalating tensions on the Korean Peninsula. The statement urged Washington to “abandon intimidation, sanctions and suppression” of North Korea.

The Chinese and Russian leaders also pledged to intensify their cooperation. Andrew Belousov, the new Russian defense minister , was with Putin on this trip, which analysts say signaled military cooperation likely was at the top of the Russian’s leader’s agenda. In recent months, Moscow has spoken of the benefits of stepping up joint military exercises between the two countries.

For Moscow, what Pyongyang can provide beyond the war in Ukraine is limited, and strengthening the bilateral relationship with Beijing for economic support will be much more valuable to Putin, said John Everard, a former U.K. ambassador to North Korea and Belarus.

“North Korea is not a priority for Putin,” Everard said. “North Korea is just having a wild fling with Russia.”

Write to Lingling Wei at , Ann M. Simmons at and Timothy W. Martin at