Washington CNN  — 

North Korean leader Kim Jong Un ended a celebratory visit to China’s President Xi Jinping on Wednesday with tea, praise, handshakes – and a message for the US.

Amid lingering questions over Pyongyang’s willingness to denuclearize and an escalating trade war between the US and China, Kim’s trip reinforced the idea that Beijing remains a key player – a variable that President Donald Trump needs and yet one that remains outside his control.

Administration officials have said that they will maintain sanctions on North Korea even as talks continue, and stand ready to intensify that economic pressure should Pyongyang fail to cooperate. But China, North Korea’s biggest trading partner, ultimately has power over whether sanctions on Pyongyang truly bite.

With tensions climbing between Beijing and Washington over trade, some analysts point to the warmth on display during Kim’s visit to Beijing as a warning from Xi that Trump’s moves on trade could undermine the most ambitious goal – peace with North Korea – on his foreign policy agenda.

“I think China is sending a message to Trump: You want to put trade tariffs on us and have our cooperation with North Korea? You can’t have both,” Bill Richardson, the former US energy secretary, ambassador and repeat US envoy to North Korea, told CNN.

Complex relationships

Kim’s visit was his third pilgrimage to Beijing in as many months and came just days after the North Korean dictator’s high-profile June 12 summit with Trump in Singapore.

Publicly, Xi has vowed to maintain a constructive role in facilitating efforts toward denuclearization and supported North Korea’s commitment to that goal despite issues with the US over trade.

But tensions are rising. On Monday, Trump ordered the US trade representative to prepare new tariffs on $200 billion in Chinese imports. Trump was reacting angrily to Beijing’s decision to match $50 billion in tariffs he placed on Chinese goods on June 15 to protest China’s “unfair trade practices.”

“Again and again the US has been provoking a trade war,” China’s Foreign Ministry spokesman Geng Shuang said Tuesday. He said China does not wish to fight a trade war, “but is not scared of one.”

“We advise the US side to return to reason, and stop words and actions that harm itself and others,” Geng said.

On Tuesday, State Department spokesperson Heather Nauert cautioned against conflating disagreements over trade with China’s cooperation in talks with North Korea, noting that the US maintains complex relationships with many countries.

“We have areas where we work with China and have – and we have strong relations, but there are also areas where we’re not always in agreement with China, and we will certainly bring those to light,” she said, highlighting the “good work that President Xi and the Chinese government have done in helping to bring North Korea to the negotiating table.”

“We want to have a constructive relationship with the government of China. In order to do that, we need to repair, make some progress on some issues related to trade,” Nauert said.

According to Mintaro Oba, a former Korea desk officer at the State Department under President Barack Obama, it is not yet clear whether trade tensions between the US and China are having an impact on negotiations with North Korea, but he warned that Xi could temper his cooperation if tensions continue to rise.

“The Chinese are still trying to preserve the space to climb down from this,” he told CNN. “But if the Trump administration continues to escalate the fight on trade so far that relations sour in a major way, it’s possible the Chinese will feel less and less inclined to cooperate on enforcing and generating pressure on the North Korean regime.”

China has helped make the Trump administration’s “maximum pressure” campaign against North Korea effective, US officials say, but historically Beijing has been slow to apply sanctions against Pyongyang or has looked the other way on Chinese companies doing business with Pyongyang and on North Korean smuggling.

Beijing fears a regime collapse next door that could send desperate refugees flooding across its borders and even worse, the prospect of US troops moving into North Korea as a stabilizing force, bringing them right to Chinese borders.

Looking for leverage

Xi feted Kim during his visit, underscoring the newly warm ties by sending crowds of jubilant children to greet Kim waving Chinese flags and jumping up and down.

The Chinese leader praised Kim for his handling of the US meeting last week in Singapore and conveyed his satisfaction with the results of the summit as well as Pyongyang’s goal of economic development, according to Chinese state media CCTV.

As Trump continues to demand credit for his role in making “initial steps toward a deal” with North Korea by establishing a personal rapport with the young dictator, Kim is pulling all the levers available to strengthen his own negotiating position.

His relationship with China is one of them, according to Richardson, who said Xi holds the power to loosen sanctions that are biting the North Korean economy by looking the other way on cross-border smuggling and energy restrictions imposed by the US and United Nations.

“I believe Kim Jong Un is trying to delay denuclearization and do it at his own pace,” he said, noting that can be accomplished only with sanctions relief from China – a step the North Korean leader views as an apt reward for rapprochement with Trump.

While Trump has publicly claimed to have “solved” the North Korea issue during his made-for-television meeting with Kim, the reality of the situation remains more complex as Kim continues to seek negotiating leverage.

“Kim’s logic is pretty simple: more options, more leverage,” said Oba. “Without engagement with the United States, Kim going to Beijing would make him look desperate and highlight North Korea’s dependence on China.

“And without China clearly backing North Korea, the United States might feel more free to abandon diplomacy and ramp up pressure. Now he gets to look independent and strong while playing both sides to get the best possible situation for North Korea.”

Critics argue that Kim has only been emboldened by Trump’s failure to demand specific concessions when the two met face-to-face.

Sources have told CNN that there is nothing to suggest that North Korea has begun destroying its missile launch sites, despite Trump’s repeated claims to the contrary and his declaration last week that the country is no longer a nuclear threat.

Vipin Narang, an associate professor of political science at the Massachusetts Institute of Technology who studies nuclear proliferation, told CNN that Trump’s decision to suspend August’s joint military drills with South Korea, without demanding North Korea take concrete steps toward disarmament, concedes strategic flexibility to both Kim and Xi.

North Korea and China have long pushed for an end to US military exercises with Japan and South Korea, suggesting that Pyongyang would stop military exercises in return, known as a “freeze for a freeze.”

“Now that Trump seems intent on escalating the trade war with China, if Kim Jong Un decides to skirt the margins of ‘freeze for freeze,’ there isn’t a snowflake’s chance in hell that China sees that as a violation justifying putting any screws on North Korea,” Narang said.

He referenced a recent headline to further illustrate his point.

“The Economist may have said ‘Kim Jong Won,’ ” Narang said, referring to a pun on the magazine’s cover about the summit, “but it really should’ve been Xi Jinping winning,” he said.

CNN’s Steven Jiang and Joshua Berlinger contributed to this report