China is popularly viewed as the winner in Russia’s clash with the West over Ukraine: For starters, the dispute has diverted the United States’ political energy and resources away from its Asia-Pacific pivot and handed China leverage over Russia on energy and economic issues. But this conflict does not leave Beijing unscathed, especially when it comes to the country’s own defense modernization plans and future security cooperation with Russia. China’s history of technological dependence on Russia and Ukraine—the heirs of the Soviet Union’s military-industrial complex—is now pulling Beijing in two conflicting directions. It can either markedly increase its reliance on Russia’s defense exports or support Ukraine’s fledgling defense enterprises in order to maintain bilateral trade relations and access to Kiev’s technological expertise. Should Beijing pursue the first option, it might find itself in an uncomfortable situation in which it over-relies on a major power that is not its ally. But the second option could lead to frictions with Moscow, and in effect, defense cooperation with a country that is now a Western ally.

Between the APEC summit, hosted by China in early November, and the G–20 gathering in Australia a few weeks later, Russia’s Defense Minister Sergei Shoigu met with officials in Beijing to discuss joint naval drills and the early steps required for forming a Russian–Chinese military bloc in the Asia-Pacific region. Even if this diplomatic meeting is not the beginning of a genuine military alliance, Russia and China have plenty to discuss when it comes to defense cooperation. In 2013 and 2014 they reached deals on several important weapon systems, including the sale of 24 Su-35s, Russia’s most advanced multi-role fighter jets; S-400 air defense systems, which can dominate the air space in the Taiwanese strait; and four Lada-class submarines, half of which will be built in China; as well as the prospective sale of the new IL-476 transport aircraft. In 2013, China only made up 12.5 percent of Russia’s new arms exports, but Russia made up 67.8 percent of China’s arms purchases, according to the Stockholm International Peace Research Institute. China remains dependent on Russian engines to power its fighters, tanks, and submarines. For example, the FC-31 stealth fighter jet, which Beijing proudly displayed during the APEC ceremony, flies only because it is fitted with a Russian-made Klimov engine. The same can be said for a good percentage of China’s military aircraft.

Enter Ukraine, which, for the past several years, has enabled China to reduce its dependence on Russia’s defense industry by providing an alternative source for technologies that Russia either can’t, or won’t, sell to Beijing. Having utterly starved its armed forces by failing to properly budget for weapons procurement since its independence in 1991, Ukraine has sustained its defense industry by modernizing and refurbishing Soviet equipment and manufacturing for export all the equipment it can produce. China has been buying Ukrainian turbofan engines for a range of aircraft, diesel engines for tanks, gas turbines for destroyers, and air-to-air missiles for its Su-27 knockoff, known as the J-11. In 2011, Beijing bought 250 turbofans for trainer and combat aircraft, along with 50 diesel tank engines. The Chinese navy heavily used Ukrainian engines for its destroyers, although it will start producing these indigenously at the Harbin Engine Factory once Kiev lives up to its promise to transfer the technological know-how to Beijing.

Russia is uneasy with all of this, but it was particularly unhappy about China’s reverse-engineering of the Russian Su-27 fighter into its J-11 with help from Ukrainian engineers and facilities. It is an unforgotten moment of bitterness in Russia’s defense relations with China. Moscow subsequently cut Ukraine from licensed production of the Su-27, and because of this experience, prefers to export only proprietary systems that China cannot duplicate with Ukraine’s help. No wonder, then, that when Russian troops took control of Crimea in March, Beijing, worried about its military future, moved quickly to take possession of the second Zubr-class landing craft it had ordered from Ukraine, even before the large hovercraft completed sea trials. Ukrainian tugs pulled the Zubr out of the Feodosia Shipyard to meet a Chinese heavy-lift ship, which hastily transported it back to China. Ukraine has indeed played a small but rather consequential role in providing China’s military with key technologies, engineering expertise, naval capabilities, and engine components. Within China’s armed forces, Ukrainian products are often used wherever Russian products are not.

Russia’s conflict with Ukraine thus poses several challenges for China. The first problem stems from the long-running symbiosis between Russia and Ukraine’s defense industries, which they inherited as former republics of the Soviet Union. As a result, they share many areas of co-dependency or joint production. Russia is a declining but prominent buyer of Ukrainian defense products and a key customer of almost every major Ukrainian defense enterprise. Russia believes that Ukraine’s defense industry will die without its business; Ukraine thinks that Russia’s defense industry will spend years struggling to find a new supplier. Nobody is certain how these two military–industrial complexes can survive without each other or what havoc a divorce might wreak. And China, which depends on both countries for critical defense supplies, has no idea what to expect from a future split. The only sure thing is that Russia and Ukraine might promise China weapons systems or technologies that they will not be able to deliver in the future.

Another looming issue for Beijing is that, no matter what Kiev decides to do, Moscow is now determined to attain full independence in its defense production. Russian defense circles have been arguing for independence from Ukrainian industries since the Orange Revolution in 2004, but a lack of political will and funding kept Moscow from achieving this goal. Now that Russia is in direct conflict with Ukraine, and faces an openly hostile Ukrainian leadership, it has no alternative but to pursue self-sufficiency. Ukraine levied sanctions against Russia this year and suspended some defense cooperation, but with exemptions so that Ukraine could keep its own defense industries afloat.

Without access to the Russian market, and Russian components for their production, the diminutive Ukrainian defense industry is likely to wither and fade. Ukraine cannot replace the volumes of equipment Russia traditionally ordered, and it is doubtful that it can make weapons systems without Russian components, save for light armor and tanks. Ukraine’s government also lacks the funds to revive the industry or become its own best customer. President Petro Poroshenko raised the defense budget midyear by $600 million to about $2 billion and plans to increase it to $3 billion by 2017. But this level of funding is woefully insufficient during a crisis. After all, Poland’s defense budget is $10.4 billion and it is not at war with Russia.

Assuming that Ukraine’s defense industry survives, China must consider that one of its key defense suppliers is a Western ally. This means that, as with Russia, China might find itself facing Western sanctions one day if it acts aggressively during a conflict in the Asia-Pacific region. The West’s reaction to Russia’s annexation of Crimea has shown Beijing that the United States does not hesitate to reach for coercive tools such as suspending existing defense cooperation or pushing its allies to curb the export of dual-use technology to the target country. Further, Ukraine’s political leadership is on a singular trajectory toward EU membership, with aspirations for NATO, and would have little compunction about canceling deals with China if it proved necessary. China’s actual defense budget is unknown, but U.S. figures show that it is the second largest in the world, exceeding $145 billion in 2013. As a rising superpower, Beijing may soon be forced to consider that its military will increasingly rely solely on either Ukraine or Russia for its growing defense needs.

Although it is far-removed geographically from Kiev, Beijing faces several difficult short-term choices when it comes to dealing with Moscow. The immediate concern for China’s foreign policy is whether or not to assist Ukraine by supplying it with munitions after years of cooperation and amicable relations. Ukraine’s defense against pro-Russian separatists involves heavy use of rocket artillery. The army has fired countless rounds from Soviet BM-21 Grads, BM-30 Smerch, and other artillery systems. Given that Ukraine never invested in buying new munitions for these systems, it is safe to say that every single rocket the army has fired this year was probably expired and that it is likely running out of ammunition. China is one of the few countries that is not a Russian ally and has current ammunition for these systems. Ukraine is openly seeking military assistance from the United States and it is hard to imagine that Kiev has not privately approached China with a similar request. If Russia has no problem arming Vietnam and India, China may also choose to arm Ukraine, although it is unclear what sort of friction that would create with Moscow. Instead of an effortless strategic gain, Beijing now has to delicately balance its relationships with Russia and Ukraine, while figuring out what to do about its dependence on both countries to accommodate its growing military needs.