BEIJING (NYTIMES) - The war in Ukraine is far from over, but a consensus is forming in Chinese policy circles that one country stands to emerge victorious from the turmoil: China.
After a confused initial response to Russia's invasion, China has laid the building blocks of a strategy to shield itself from the worst economic and diplomatic consequences it could face, and to benefit from geopolitical shifts once the smoke clears.
China's President Xi Jinping has avoided criticising Russian leader Vladimir Putin, but he has also tried to distance China from the carnage. His government has denounced the international sanctions imposed on Russia but, so far at least, has hinted that Chinese companies may comply with them, to protect China's economic interests in the West.
Mr Xi reached out to European leaders last week with vague offers of assistance in negotiating a settlement, even as other Chinese officials amplified Russian disinformation campaigns meant to discredit the United States and the North Atlantic Treaty Organisation (Nato).
Officials in Washington claimed, without providing evidence, that after the invasion, Russia asked China for economic and military assistance, which a Chinese official has denounced as disinformation.
In the end, China's leadership has calculated that it must try to rise above what it considers a struggle between two tired powers and be seen as a pillar of stability in an increasingly turbulent world.
"This means that as long as we don't commit terminal strategic blunders, China's modernisation will not be cut short, and on the contrary, China will have even greater ability and will to play a more important role in building a new international order," Professor Zheng Yongnian from the Chinese University of Hong Kong, Shenzhen, wrote in a widely circulated article.
At the heart of China's strategy lies a conviction that the United States is weakened from reckless foreign adventures, including, from Beijing's perspective, goading Mr Putin into the Ukraine conflict.
In this view, Russia's invasion has dragged American power and attention towards Europe, making it likely that US President Joe Biden will try but fail to put more focus on China and the broader Asia-Pacific region.
"All the difficulties and all the balancing and all the embarrassment... those are short-term," said Ms Yun Sun, director of the China Programme at the Stimson Centre in Washington.
"In the long run, Russia is going to be the pariah of the international community, and Russia will have no one to turn to but China."
China's path ahead is by no means certain. Drawing too close to Russia might entrench animosity towards China in Europe and beyond, a possibility that worries Mr Xi's government.
And if Germany, France and other allies build up their defences as promised, the US could ultimately be freed up to shift more of its military resources towards countering China.
"We also feel very, very anxious because the Russia-Ukraine war will force Europe to lean to the US, and then China will be dragged deeper into a dilemma," said Professor Zhu Feng, who lectures international relations at Nanjing University.
America's allies in the Pacific, including Japan and Australia, "will also adopt a stronger military posture. So it all seems unfriendly to China", he said.
China's initial stumbles after Russia's invasion have also raised concern about Mr Xi's ability to navigate the war's aftershocks.
He has repeatedly warned Chinese officials that the world is entering an era of upheaval "the likes of which have not been seen for a century". Yet those officials seemed ill-prepared for the upheaval of Mr Putin's assault on Ukraine.
Up to the day of the invasion, they scoffed at warnings that Russia was poised for war, instead accusing the US of stoking tensions. Since then, they have struggled to reconcile sympathy for Mr Putin's security grievances with their often-stated reverence for the principle of national sovereignty, including Ukraine's.
Mr Xi, in a video conference with French President Emmanuel Macron and German Chancellor Olaf Sholz, lamented "the rekindling of the flames of war" in Europe. Yet his diplomats have fanned the flames of Russian disinformation, accusing the US of developing biological weapons in Ukraine.
"This is just not good for China's international reputation," said Mr Bobo Lo, an expert on China-Russia ties at the French Institute of International Relations. "It's not just China's reputation in the West; I think it also affects China's reputation in the non-West, because it's essentially associating itself with an imperial power."
China could also face economic disruptions from the war and the Western efforts to punish Russia by restricting trade and cutting off its financial institutions.
Chinese officials have denounced such measures, and while the US and its allies have shown remarkable unity in imposing them, other countries share Beijing's reservations about using powerful economic tools as weapons.
In any case, China's economy is large enough to absorb blows that would cripple others. Chinese firms may even be able to take advantage of Russia's desperate need for trade, as happened when Moscow faced sanctions over the annexation of Crimea in 2014.
China's strategy reflects a hardening of views towards the US since Mr Biden came to office last year- in large part, because officials had hoped for some easing after the chaotic and confrontational policies of former president Donald Trump.
"In its China strategy, the Biden administration's policy continuities with the Trump administration are clearly bigger than any differences," Dr Yuan Peng, president of the China Institutes of Contemporary International Relations in Beijing, wrote late last year.
"Biden has repeatedly avowed that the United States is not in a 'new Cold War' with China, but China often feels the chill creeping in everywhere."
Whatever happens in the war, China sees its deepening ties with Russia as a way to cultivate a counterweight to the US.
The partnership that Mr Xi and Mr Putin celebrated last month at the Winter Olympics in Beijing has become too important to sacrifice, whatever misgivings some officials have about the war.
Arguing that the era of American dominance after the Soviet Union's collapse in 1991 was a historical anomaly, both Mr Xi and Mr Putin have embraced geopolitical doctrines that call for their countries to reclaim their status as great powers.
Just as Mr Putin depicts the US as menacing Russia on its western frontier, Mr Xi sees US support for Taiwan - the self-ruled island that Beijing views as a renegade province awaiting reunification with the mainland - as a similar threat.
As it turns to Beijing for support against Western sanctions, Russia will become increasingly beholden to China as its diplomatic and economic lifeline, while serving as its strategic geopolitical ballast, analysts say.
"The old order is swiftly disintegrating, and strongman politics is again ascendant among the world's great powers," wrote Prof Zheng of the Chinese University of Hong Kong, Shenzhen.
"Countries are brimming with ambition, like tigers eyeing their prey, keen to find every opportunity among the ruins of the old order."