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 sanctions 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 been caught flat-footed by Russia's military offensive, fierce Ukrainian resistance, and the volume of the resulting international anti-Kremlin backlash.
Beijing, which has long demanded respect for territorial integrity in border disputes with its 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 Treaty Organisation (NATO) are valid.
It has refused to condemn Moscow, with Chinese government spokespersons 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 public discourse, initially allowing vociferous posts that tracked Beijing's anti-US rhetoric, before pivoting 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 always 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 its 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.
- Least bad outcome -
It instead urged its 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 Bangalore-based Takshashila Institution.
"If we see 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 Ukrainian 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 its 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 its ties with the rest of the world."
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)
Ukraine Says "Strengthening" Positions In Russia Amid Raging War Ukraine, Russia Both Claim Advances In Kursk Region US Welcomes India's Engagement In War Between Russia, Ukraine Life On Earth Originates From One Ancestor, Older Than Previously Believed Send Reports Every 2 Hours: Centre To States On Kolkata Horror Protests Siddaramaiah's Swipe At Governor Amid Calls For Resignation: 10 Points Trump, Kamala Harris To Fight For Pennsylvania Votes With Rally, Bus Tour Send Reports Every 2 Hours: Centre To States On Kolkata Horror Protests Thar, Scorpio SUVs Inside Restricted Zone In Ranthambore Tiger Reserve Seized Track Latest News Live on NDTV.com and get news updates from India and around the world.