Just before Russia invaded Ukraine, Vladimir Putin met Xi Jinping in Beijing. Shortly afterwards, the two countries announced a “no limits” partnership.

Whether there are truly no limits to the China-Russia partnership may become clear in the coming days, following reports that Moscow has asked Beijing for military aid. If Xi grants that request, China would in effect be entering a proxy war with the US and Nato nations that are backing Ukraine. That decision could spell the end for the globalised economic system that has fuelled China’s extraordinary rise over the past 40 years.

Russia and China share a deep hostility to America’s global power. But they have approached their rivalry with the US in very different ways. China can afford to play a “long game”, relying on its economic might to change the global balance of power. But Russia, in a weaker economic position, has gambled on brute force in Ukraine.

Putin’s wager now threatens Beijing’s long game. Chinese policymakers may have envisaged an eventual rupture in relations with the US, yet thanks to Russia, they now face confrontation with the west on a greatly accelerated timetable.

If China helps Russia to circumvent western sanctions, it is likely to be targeted with secondary sanctions — a point that Jake Sullivan, the US national security adviser, will make to China’s Yang Jiechi when they meet this week. Supplying arms to the Russian military would fuel calls for western sanctions on China, consumer boycotts and corporate withdrawals.

A short, victorious Russian war would have suited China. Beijing’s favoured narrative about the inexorable decline of American power would have looked even more credible. The stage might have been set for a Chinese attack on Taiwan.

Instead, Russia has got bogged down. The western alliance has been revived, and the US and its allies have unveiled a new armoury of economic sanctions that will look very threatening in Beijing.

China is now having to digest the news that, as a result of western sanctions, Russia has lost access to most of its foreign reserves. As the economist Barry Eichengreen points out, one of the main reasons that countries hold foreign reserves is “as a war chest to be tapped in a geopolitical conflict”. But China, which has the world’s largest foreign reserves, has just discovered that it could lose access to its war chest overnight.

China is not nearly self-sufficient in either energy or food. It has worried for decades about the “Malacca Dilemma” — the threat that the US navy could blockade China by cutting off key shipping routes. China’s huge investments in its navy are partly aimed at averting that possibility. Now, however, Beijing has to consider the possibility that a freezing of the country’s foreign reserves, allied to other financial sanctions, could be just as threatening as a naval blockade.

Frustratingly for China, there is no easy way out of this. The obvious solution would be for it to trade increasingly in its own currency, the renminbi. But Beijing has shied away from making the RMB fully convertible, fearing that this would lead to destabilising capital flight.

The fact that the EU, UK, Swiss, South Koreans, Japanese and Singaporeans have joined in the financial sanctions on Russia has created a united front of developed economies that should concern Beijing. China has repeatedly measured itself directly against the US, ticking off milestones as it goes: largest trading power, largest economy measured by purchasing power, largest navy. Yet if China now has to measure itself against not just the US, but also the EU, UK, Japan, Canada and Australia, its relative position looks much less powerful.

It is clear that trying to isolate China economically would be much harder than imposing sanctions on Russia — which is itself hardly painless. China is deeply integrated into western supply chains. Many western multinationals have put China at the centre of their business strategies.

For that reason, even some of America’s China hawks have accepted that economic interdependence between the US and China is a given. But a global crisis causes people to re-examine basic assumptions. The idea of an economic severance of China from the west, once unthinkable, is beginning to look more plausible. It might even appeal to the growing constituency of economic nationalists in the west who now regard globalisation as a disastrous error.

China’s military calculations also suddenly look more complicated. If the experienced Russian army cannot easily prevail in a land invasion of Ukraine, how could China carry off the much more complex seaborne invasion of Taiwan? The Ukrainian experience suggests that the Taiwanese would fight back and that China would have to accept heavy casualties — as the west poured in military aid to Taiwan. And while President Joe Biden has repeatedly ruled out fighting for Ukraine, he has suggested that the US would defend Taiwan.

It is often assumed that China will be the senior partner in the “no limits” partnership with Russia but Xi’s decision to embrace Putin now looks likes a miscalculation. It is hard to play the long game if you tie yourself to a reckless gambler.