The US and China hit each other with billions of dollars in tariffs this week as the two countries edge closer to a trade war, a dramatic shift in a relationship which seemed to be growing stronger under President Donald Trump as he relied on Beijing for help with North Korea.
"China does not want a trade war, but China is not afraid of a trade war," the country's commerce ministry said in a statement Friday. "We are confident in our capability to face up to any challenge."
That's a marked departure from November, when Chinese state media hailed Trump after his visit to Beijing, and the US leader remarked he had "very good" chemistry with President Xi Jinping.
That Trump seems willing to risk a trade war with China just weeks before what's set to be a history-making meeting with North Korean leader Kim Jong Un, shows how sidelined Xi's become in efforts to rein in Pyongyang's nuclear weapons program.
The point is underlined by the Trump's appointment Thursday of John Bolton as national security adviser, a longtime hawk who has promoted a military response to North Korea, an option repeatedly denounced by China.
'Sea change' in policy
While candidate Trump was highly critical of China, even accusing the country of "raping" the US on trade, as President he took a very different tack.
On his visit to Beijing last year, he said he gave China "great credit" for its trade policies. "I don't blame China, who can blame a country for being able to take advantage of another country for the benefit of its citizens," he said.
At the time, many analysts put this shift in attitude down to personal rapport between Trump and Xi, and Washington's desire for China's assistance in tackling the North Korea issue which has dogged Trump since his election.
Trump prefaced his trade action this week by insisting he views China as a "friend" and said he has "tremendous respect" for Xi. "They are helping us a lot in North Korea," Trump said. "But we have a trade deficit ... there are many different ways of looking at it, but no matter which way you look at it, it is the largest trade deficit of any country in the history of the world."
Euan Graham, Director of the International Security Program at Australia's Lowy Institute, told CNN the "administration's China policy was very narrowly framed around North Korea to start with."
But he pointed to a gradual shift in attitude, in particular a new US national security strategy classifying China and Russia as "revisionist powers," a move that was denounced by Beijing as demonstrating "Cold War mentality."
"That's a sea change which goes beyond the President's whims on policy," he said. "It's reflective of a broader pushback which includes not just the security but also increasingly business leaders, though that does not mean there is widespread support for tariffs."
China 'sidelined' on North Korea
While Trump and many of his supporters have been critics of China in the past, the fact he was willing to risk relations with Beijing would appear to show a shift in thinking in Washington on China's importance on the North Korea issue.
Since the reopening of diplomatic relations between South and North Korea in January, with Pyongyang participating in the Winter Olympics and inviting President Moon Jae-in to North Korea, analysts say Seoul has been in the driving seat on engagement policy.
Kim has never met Xi, and relations between Pyongyang and Beijing have been strained since the death of the North Korean leader's father, Kim Jong Il, and subsequent execution of his uncle, Jang Song Thaek, who was widely seen as China's man in Pyongyang.
In recent months, Graham said, China has become "diplomatically sidelined from the process because the South Koreans have successfully regained the initiative."
"China was in a rather good position (previously), in that it was sort of a win-win," he added.
"If North Korea came to heel, China could take credit for it, if North Korea misbehaved that took the attention away from China's own strategic challenges in the South China Sea and the Taiwan straits. Now it's not looking so rosy for China on that front."
China's sidelining comes as a potential breakthrough with North Korea seems more likely than at any point in years, with Moon and Kim expected to meet next month -- the first time Kim has met a foreign head of state -- with the potential for a Trump-Kim summit in May.
But while analysts agreed a trade dispute between the US and China did not risk negotiations, new uncertainty has been raised over the talks with the appointment by Trump of arch North Korea hawk John Bolton as national security adviser.
As recently as February, Bolton wrote an op-ed arguing the "legal case for striking North Korea first," and he responded to the news of a potential summit with Pyongyang by asking, "how do you know that the North Korean regime is lying? Answer: Their lips are moving."
Joshua Pollack, a senior research associate at the Middlebury Institute of International Studies, said Bolton was a "profoundly irresponsible" choice.
"Trump has made the denuclearization of North Korea his signature foreign-policy initiative," he wrote Tuesday. "Bolton is best known for making counterproliferation the handmaiden of war and regime change. Naming him (national security adviser) is just wild. Doing so now is even wilder."
Graham predicted Bolton's hardline thinking "increases the likelihood that the summit will be sabotaged in some way or that the North Koreans now get cold feet."
Bad timing for Xi?
A potential trade war with the US, which could have massive ramifications for China domestically, comes just as Xi was riding high, having begun his second term as President with an option to rule for life.
Analysts had warned that Xi's new absolute power could leave him exposed were the country to face economic or other shocks, as unlike under the previous collective leadership system, there is no one else to bear the blame.
"If 'consolidation of power' was a precondition for implementing his reform program and leading the rejuvenation of the Chinese nation, that condition has now been met and he needs to deliver," Jon Sullivan, director of the China Policy Institute at the University of Nottingham, told CNN last month.
"And, if he doesn't deliver and refuses to go quietly, well that's a scenario we've seen play out in other regimes many times before."
Trade war with the US could provide a dangerous challenge to Xi, but it could also be spun to his benefit, said Andrew Polk, co-founder of Trivium China, a Beijing-based consultancy.
"Xi and Trump are both playing to domestic audiences, and he has a mandate to look tough just like Trump does," he said.
"He can use use this as a rallying cry to get people behind his leadership ... because this is clear aggression from an outside power, it almost plays into Xi's hands domestically."
Trump's well-known capriciousness may also help Beijing's avoid public opprobrium for any potential ramifications should things escalate.
"He is an unpredictable force, they don't even really have to propagandize it," Polk said. "From a messaging standpoint it plays very well for them."