By , a senior China fellow at the Foundation for Defense of Democracies and a former U.S. diplomat.

Chinese President Xi Jinping’s worst nightmare is playing out in Ukraine. Regardless of whether he possessed detailed or advance knowledge of Russia’s invasion plans, two things are almost certain: Xi expected Russia’s battle-hardened military to quickly rout the Ukrainians, and the international community’s response would be muted.

Russia Invades Ukraine?

Neither came to pass. Instead, Russian President Vladimir Putin’s messy Ukrainian war has morphed into a case study on how not to conduct an invasion. Even worse, Putin’s many battlefield setbacks have likely neutralized any optimism Chinese military planners may have harbored about easily retaking Taiwan by force.

The upshot is Putin’s unprovoked, all-out assault on Ukraine may have accomplished what until recently seemed all but impossible: derailing Beijing’s timetable to invade Taiwan.

Prior to Russia’s invasion, the likelihood of a near-term Chinese attack on Taiwan was already low. Although China has sought to close its military’s capability gaps with the United States, the People’s Liberation Army (PLA) still lacks the means and know-how needed to make good on Beijing’s reunification threats. Moreover, there remains scant evidence that China is actively considering plans to invade Taiwan. The reason: Xi is keen to maintain stability before this fall’s 20th Communist Party Congress, when he will assume a once-unthinkable third term as party secretary.

Certainly, China has stepped up its incursions in and around Taiwan’s airspace. Nevertheless, these provocations do not signal a near-term invasion. Rather, such operations are intended to stoke domestic nationalism and often correlate with important symbolic anniversaries. For example, the PLA dispatched a record of nearly 80 fighters and bombers into Taiwan’s airspace last October to mark China’s founding. Other incursions were clearly aimed at discouraging Taiwan from embracing policy positions abhorrent to Beijing. Last week, Chinese fighters entered Taiwan’s airspace just after Taiwanese President Tsai Ing-wen voiced her support for Ukraine and other Taiwanese politicians sought to draw an equivalence between Russia’s dispute with Ukraine and China’s with Taiwan.

Regardless, a military reunification with Taiwan will not happen overnight. Put differently, it will not be a strategic surprise, just as Russia’s invasion preparations were there for all to see. Weeks, if not months, will be required to position Chinese forces and various logistical elements at pre-identified staging areas along China’s coast. Those herculean efforts pale in comparison to the immense difficulty China’s military will face in safely transporting its forces to the limited number of suitable Taiwanese landing sites located more than 100 nautical miles away. Further complicating China’s planning is that its military has not experienced anything resembling combat in more than 40 years. That is the principal reason why China has sought Russia’s counsel as it devises workarounds to these and other challenges. Look no further than January’s trilateral naval exercises—dubbed 2022 Maritime Security Belt—during which China, Russia, and Iran sought to hone their anti-air and nighttime operational skills at sea.

What then must China’s military planners be thinking as they observe their Russian partners struggling to accomplish any of their stated objectives in Ukraine?

On a purely operational level, invading Ukraine should have been a walkover for Russia, at least from Beijing’s perspective. Russia enjoys close physical proximity to its victim, including the ability to easily insert ground forces via accessible land routes. Having previously annexed Crimea in 2014, Russia also maintains extensive knowledge about the theater of operations. In contrast to China, Russia’s military is also skilled in urban warfare. What’s more, Russia spent decades fostering deep economic and trade linkages with countries throughout Europe that might have neutered the Western response. As we all know, many European countries are more dependent than ever on Russian oil and gas. Some—such as Poland, Estonia, Slovakia, and Finland—rely on Russia for most if not all their energy needs. Putin’s hedging strategy was thus predicated on constraining Europe’s ability to retaliate against Russia should it harass or invade its neighbors.

Of greatest intrigue to China should be the willingness of everyday Ukrainians to risk their lives to defend their democracy as well as Kyiv’s ability to thoroughly control the information environment. Every hour, videos of Russian troops battling with Ukrainian resistance fighters are beamed into living rooms and editorial offices around the world. Having refused to leave the country, Ukrainian President Volodymyr Zelensky, with little more than a smartphone, has become a symbol of democratic defiance. Worse yet, hundreds of Russian soldiers have voluntarily laid down their arms, refusing to kill innocent civilians.

Could the same tactical challenges befall China’s inexperienced military during an invasion of Taiwan? The simple answer: Of course they could, which is why China is acutely monitoring the situation.

More broadly, Beijing could hardly have predicted the overwhelmingly unified international response to Russia’s incursion. Frankly, no one did. The severity of Western sanctions imposed on Moscow, including cutting off Russia’s central bank from the global financial system, is without precedent. Already, Western sanctions, along with new export controls, are wreaking havoc on the Russian economy—to the point that it may never fully recover. At the same time, Europe and the United States appear prepared to absorb the costs associated with such harsh measures, even at the expense of their own economic growth and extensive ties to Russia’s private sector.

China now finds itself defending Russia’s actions alongside a tiny number of failed states, including North Korea, Syria, and Belarus.

Russia’s ejection from the international order also extends to the United Nations, where China has worked extensively to build up its international brand and exert its influence. In a matter of days, U.N. diplomats have reduced Russia, a veto-wielding member of the U.N. Security Council, to near-pariah status. China now finds itself defending Russia’s actions alongside a tiny number of failed states, including North Korea, Syria, and Belarus. Leading that group of international misfits is a far cry from Xi’s goal of ushering in a “new era of international relations,” one in which Beijing and Moscow supplant the United States and European Union. Moreover, if China envisioned that its trade links with other countries would shield it from multilateral condemnation after a military strike on Taiwan, all available evidence suggests that Beijing needs to rethink those assumptions.

The big unknown is how Beijing will navigate this new and unfamiliar terrain. The simple answer is no one knows—not even the Chinese. It is not an exaggeration to claim the entire world has been upended over the last two weeks, and the battle for Ukraine remains far from finished. Nevertheless, it seems all but certain that China will not launch a war it might lose, let alone lose badly. Instead, Beijing will do what it does best: Double down on its long-term, incremental strategy of retaking Taiwan by “all means short of war.” Taiwan will likely face increasing cyberattacks and other forms of non-kinetic coercion aimed at demoralizing the population into eventual capitulation. China will also accelerate its campaign to delegitimize Taiwan on the international stage, denying Taipei recognition in various international fora and perhaps even whittling down the already small number of countries that officially recognize Taiwan.

That’s the bad news.

The good news is the Ukrainians have, in their own way, provided the United States as well as countries throughout Europe and the Pacific with a road map of sorts for how to bolster Taiwan’s resilience. That means hardening Taiwan’s cyberinfrastructure, devoting additional resources toward early detection and monitoring, and investing in training and specialized equipment designed to enable Taiwan’s civilian population to repel a Chinese military invasion. Indeed, such moves must occur in conjunction with Western efforts to augment Taiwan’s defensive capabilities. The trick will be to balance these self-reinforcing efforts while denying Beijing any legitimate rationale to launch an unprovoked attack—or at least one that would be broadly accepted by the international community.

All of that is easier said than done, of course. But so, too, was rallying the world to Ukraine’s defense.

Craig Singleton is a senior China fellow at the Foundation for Defense of Democracies and a former U.S. diplomat. Twitter: @CraigMSingleton

MORE FROM FOREIGN POLICY

European Commission President Ursula von der Leyen, Canada's Prime Minister Justin Trudeau, U.S. President Joe Biden and France's President Emmanuel Macron walk along the boardwalk during the G7 summit in Carbis Bay, Cornwall, south-west England on June 11, 2021.

The West Is Sleepwalking Into War in Ukraine

NATO Secretary-General Jens Stoltenberg

Is There a Risk of a NATO vs. Russia War?

Russian army trucks are pictured on a riverbank in Nar, near the border between Russia and Georgia, on Aug. 15, 2008.

Russia Is Reenacting Its Georgia Playbook in Ukraine

Ukrainian servicemen patrol the front line.

Insurgency in Ukraine Could Lead to Major War in Europe