Beijing:  Chinese President Xi Jinping and Russian counterpart Vladimir Putin toasted a friendship with “no limits” at a warm meeting in February, but just one month later that bond is being tested by the war in Ukraine.

With international outrage and sanstions mounting against Russia, Beijing is scrambling to avoid being tainted by association with Moscow while also maintaining their increasingly close ties.

Once bitter Cold War rivals , China and Russia have moved closer than ever since Xi Jinping took power nearly a decade ago, driven by their shared desire to confront US power.

But China seems to have have been caught flat footed by Russia’s military offensive, fierce Ukranian resistance, and the volume of the resulting international anti-Kremlin backlash.

Beijing, which has long demanded respect for territorial integrity in border disputes with it’s own neighbours, has been forced into rhetorical contortions on Ukraine to avoid upsetting Russia.

While maintaining lip service to national sovereignty, China has insisted that Moscow’s security concerns regarding Ukraine and the broader expansion of the US-led North Atlantic Treat Organization (NATO) are valid.

It has refused to condemn Moscow, with Chinese government spoke-persons remonstrating foreign journalists at press conferences who refer to the assault on Ukraine as an “invasion”.

Bewildered Beijing

At the same time, censors on the tightly controlled Chinese Internet have struggled to shape domestic discourse, initially allowing vociferous posts that tracked Beijing’s anti-US rhetoric , before to scrub lewd messages objectifying women fleeing Ukraine as well as anti-war sentiment.

“You could see the bewilderment in the early statements,” said Sergey Radchenko, a professor at the Johns Hopkins School of Advanced International Studies.

Failure to finesse the situation puts Beijing at risk of being labelled a Putin enabler, potentially alienating Western trading partners and endangering the tenuous balance of links China has cultivated in recent years with both Russia and Ukraine.

The situation has effectively paralysed China,according to Richard Ghiasy, an expert at the Hague Centre for Strategic Studies.

“Security interests virtually allows trump economic interests” in China’s calculus, and it will not fundamentally shift toward a more pro-Ukraine stance, he told AFP.

Russia is “a giant, nuclear-armed and resource-rich neighbour” that China won’t risk agitating, Ghiasy said.

Beijing’s difficult position is compounded by the plight of it’s 6,000 citizens in Ukraine, who are now being gradually evacuated by road and rail to neighbouring countries along with other displaced persons.

More than a dozen governments urged their citizens to leave Ukraine by mid-February, but China refrained from doing the same.

It instead urged it’s citizens to “remain calm” and stay at home even as Russian troops moved onto Ukrainian soil, and was forced to cancel a proposed airlift after Ukraine closed its airspace to civilian planes.

In a hint of how Beijing misread the situation, its embassy in Ukraine initially urged its citizens to display China’s distinctive red flag on their cars as a protective measure, quickly retracting that advice after some reported subsequent hostility from locals.

The “political position that the Chinese government has adopted has made things difficult for Chinese citizens there,” said Manoj Kewalramani, China studies fellow at the Bangolore-based Takshashila Institution.

“If we were Chinese casualties in Ukraine, then the pro-Russian neutrality of the Chinese government that we are seeing today will become harder to maintain,” Kewalramani added.

With little room to manoeuvre, China is adopting the mantle of mediator.

Xi urged Putin in a call last week to resolve the crisis by forming a “sustainable European security mechanism through negotiations,” and China’s foreign minister told his Ukranian  counterpart that Beijing “regrets” the conflict and hopes the two sides can find a diplomatic solution.

But any mediating role assumed by China would stop short of using it’s influence to get Putin to change, said Steve Tsang, director of the China Institute at London’s School of Oriental and African Studies.

“It is outward neutrality, but in reality, still on Russia’s side,” said Tsang.

A negotiated solution is now China’s least-bad scenario, according to analysts.

The worst case, said Tsang, would be for the tightening sanctions on Russia – or a failure of its military objectives in Ukraine – to result in an uprising that ousts Putin from power, potentially leading to a pro-Western government in Moscow.

“I doubt Xi wants to see the war in Ukraine escalate further,” Tsang said.

“But he would want to see Putin be able to get what he wants without causing too much collateral damage … for China and it’s ties with the rest of the world.”