As the last NATO helicopters took off from Kabul last summer, leaving the city in the hands of the Taliban, Moscow was convinced the age of American supremacy had come to an abrupt end. “It is a country that had never really held together throughout history,” Russian Foreign Minister Sergey Lavrov said of Afghanistan. “There was a balance of power that allowed it to exist, but the Americans violated it when they tried to impose their vision of democracy.”

Just months later, the Kremlin would be saying the same about Ukraine. In a lengthy treatise that set out his own version of history, President Vladimir Putin claimed the West â€śimposed Ukrainization often on those who did not see themselves as Ukrainians.” Now, after ten weeks of bloody fighting that followed the start of his brutal invasion, it is clear Putin underestimated his enemy – both those battling for their independence, and the Western nations arming them.

Nearly 5,000 miles eastwards, however, there are fears that history could repeat itself sooner rather than later. In recent months, China has struck a belligerent tone over the breakaway Pacific Ocean island of Taiwan, with Xi Jinping declaring last October that â€śthe complete reunification of our country can be and will be realised” within his lifetime. Over the weekend, the Financial Times reported that Washington had begun high-level talks with British counterparts to develop plans in case of a military conflict.

As in Russia, China’s domestic propaganda machine went into overdrive to paint the US’ hurried withdrawal from Afghanistan as proof that it was unwilling to put American lives on the line to defend its partners in far-flung lands. While top Communist Party officials admitted the retreat threatened stability in the region, the Xinhua state media network told citizens back home that Washington is â€śthe world’s largest exporter of unrest.” At a meeting in China just last week, Lavrov declared that the two countries were throwing off Western dominance and together leading a new â€śjust, democratic world order.”

Yet the crisis Putin now has on his hands in Ukraine is a cautionary tale for Xi. While both leaders have repeatedly forecast the declining significance of the US and its European allies, the West has proven itself willing and able to stand up for Kyiv’s sovereignty even without becoming directly embroiled in the conflict. Weaponry like the British NLAW anti-tank rocket, American Javelins and Turkish Bayraktar attack drones have outclassed Russia’s own hardware and turned the tide of the war, enabling Ukraine’s comparatively small armed forces to hold their own against a global power. Given Taiwan has been a major buyer of modern weaponry from abroad, Beijing’s top brass will be forced to ask themselves whether their troops really are capable of the massive amphibious attack that would be needed to take control of the island.

Top officials have even drawn the link between the two, with Assistant US Defense Secretary Mara Karlin saying in recent days that â€śthe situation we’re seeing in Ukraine right now is a very worthwhile case study about why Taiwan needs to do all it can to build asymmetric capabilities, to get its population ready, so that it can be as prickly as possible should China choose to violate its sovereignty.”

And Taiwan’s Foreign Minister Joseph Wu, said: “We are trying to see what we can learn from Ukraine in defending ourselves,” pointing out that Russia had become embroiled in a bloodbath despite outnumbering and outgunning its opponents on paper.

Comparisons only go so far, however. The US acknowledges China’s claims to sovereignty over Taiwan, and does not formally support its aspirations for independence. Unlike with Ukraine, from a purely legal perspective, any conflict would be an internal one and Washington may well be less inclined to get involved. Beijing has also demonstrated it would see any intervention as â€śmeddling” in its internal affairs, with Foreign Ministry spokesman Wang Wenbin pointing out on Wednesday that â€śthe US recognises the People’s Republic of China as the sole legal government of China, and it acknowledged the Chinese nationals’ position that there is but one China, and Taiwan is part of China.” According to Wang, this means that any military offensive on China’s part would not be an invasion or an act of war.

At the same time, Taiwan is not alone in learning from the attack on Ukraine. Seeing the scale of Western sanctions imposed on Russia and the willingness to suffer economically to do so, China has moved to protect its assets from similar measures. Last month, regulators met in Beijing to discuss how it could shield its economy from restrictions on the use of foreign currency that could be imposed in response to an assault on Taiwan.

“No one could think of a good solution to the problem,” the FT quotes a source as saying. â€śChina’s banking system isn’t prepared for a freeze of its dollar assets or exclusion from the SWIFT messaging system as the US has done to Russia.” Both Beijing and Moscow have previously committed to working on an alternative international payments process that would allow them to do trade even in the face of opposition from the West but, as Putin himself is now seeing, the system is nowhere near able to ensure the normal functioning of the economy.

While countries like the US and the UK work to ensure that an invasion of Taiwan would end in the same kind of catastrophe as Russia’s attack on Ukraine, Moscow’s mistakes have offered a roadmap for China. And, with one of its largest partners having become an international pariah, Beijing will be faced with a decision on whether to join it.