China is treading a very fine line as the crisis over North Korea’s nuclear ambitions continues to escalate, condemning its neighbour for its latest missile test but also calling for calm from all sides – and in doing so making it clear to the US it will not be bullied into action it does not want to take.

North Korean leader Kim Jong-un’s “dangerous game of brinkmanship” was admonished by Xinhua, China’s official news agency. However, this was followed by the assertion that the US’s “belligerent tone and military exercises on DPRK’s [Democratic People’s Republic of Korea, as China officially refers to North Korea] doorstep ate into Pyongyang’s sense of security.” This, Xinhua suggested, was what prompted the nuclear test that caused as many political tremors as it did physical ones.

Geng Shuang, China’s Foreign Ministry spokesman, said that China made “stern representations” with North Korean diplomats following the blast. He also said, on the same day the US envoy to the United Nations called for the “strongest possible measures” against Kim Jong-un’s regime, that all parties should “refrain from further escalating tensions”.

The timing of the latest flare-up could not be worse for China’s President Xi Jinping, as it came in the middle of a meeting on Sunday with world leaders from Russia, India, Brazil and South Africa in the Chinese city of Xiamen, as part of a BRICS nations summit which continues today.

Similarly, last May Kim Jong-un fired off a ballistic missile hours before Mr Xi spoke to world leaders in Beijing. Peter Hayes, director of the North Korea-specialising Nautilus Institute research group, told The New York Times: “Kim knows that Xi has the real power to affect the calculus in Washington. He’s putting pressure on China to say to Trump: ‘You have to sit down with Kim Jong-un’.”

Indeed, war between North Korea and the US plus its allies would be disastrous for all involved in terms of lives lost, but China believes it has the most to lose politically. The collapse of the Kim dictatorship would cause millions of North Korean refugees to flee to China, and US troops could be based in a reunified Korea bordering China: something Mr Xi would not tolerate.

Kim Jong-un inspects weapon North Korea says is powerful hydrogen bomb Show all 6 1 /6 Kim Jong-un inspects weapon North Korea says is powerful hydrogen bomb Kim Jong-un inspects weapon North Korea says is powerful hydrogen bomb Photos released by North Korea show Kim Jong-un talking to subordinates next to a device thought to be the new thermonuclear weapon. There is no way of independently verifying the pictures STR/AFP/Getty Images Kim Jong-un inspects weapon North Korea says is powerful hydrogen bomb North Korea claims it has successfully tested an advanced hydrogen bomb which could be loaded onto an intercontinental ballistic missile AFP/Getty Kim Jong-un inspects weapon North Korea says is powerful hydrogen bomb A diagram on the wall behind Mr Kim shows a bomb mounted inside a cone STR/AFP/Getty Images Kim Jong-un inspects weapon North Korea says is powerful hydrogen bomb North Korean leader Kim Jong-Un (C) attending a photo session with participants of the fourth conference of active secretaries of primary organisations of the youth league of the Korean People's Army (KPA) in Pyongyang STR/AFP/Getty Images Kim Jong-un inspects weapon North Korea says is powerful hydrogen bomb A new stamp issued in commemoration of the successful second test launch of the "Hwasong-14" intercontinental ballistic missile KCNA via Reuters Kim Jong-un inspects weapon North Korea says is powerful hydrogen bomb A new stamp issued in commemoration of the successful second test launch of the "Hwasong-14" intercontinental ballistic missile KCNA via Reuters

Yet, it is domestic issues currently dominate the agenda for Mr Xi. The Communist Party’s 19th National Congress will convene in Beijing in mid-October, with Mr Xi set to be pre-occupied with placing trusting allies in the Party’s key decision-making Politburo, as well as accepting a second five-year term. Calm is the aim ahead of the meeting so China would like as little international strife as possible.

“China will never allow chaos and war on the [Korean] peninsula,” said Liu Jieyi, the Chinese ambassador to the UN, as he called for nations to respond to its joint proposal with Russia that North Korea stop its military actions in return for the US stopping military exercises with South Korea.

With US President Donald Trump laying the task of containing Mr Kim on China’s doorstep, tweeting about how little success Beijing has had in reining in North Korea, another Chinese state-controlled media outlet, the Global Times newspaper, said that fewer promises of “fire and fury” threats from Mr Trump were key.

Key moments in North Korea's nuclear programme

“Pyongyang’s frequent launches of intercontinental ballistic missiles and its sixth nuclear test have obviously shocked the US,” the newspaper said. “It seems Washington’s military menace against Pyongyang is not only verbal.

“This will add to North Korea’s state of alert and its determination to complete its nuclear and missile technology research. A sense of military urgency will prevail between North Korea and the US and South Korea, which may brew a hotbed which causes a fatal strategic misjudgement.”

In a dig about Mr Trump’s threat to impose harsher sanctions on countries that trade with North Korea – namely China as Pyongyang’s biggest trading partner – the newspaper added: “If the US is not able to tame North Korea, how can it force big powers such as China and Russia to yield to its demands through sanctions and deterrence?”