Over the past few months, tensions between the United States and North Korea have increased, with Kim Jung-un testing a possible hydrogen bomb on September 3 and the United Nations Security Council voting to implement further sanctions shortly after. Writers have discussed American policy towards China, the possibility of a deal with North Korea, and the need to avoid backing Kim into a corner. However, China’s perspective and the genuine possibility of a limited or complete Chinese intervention into North Korea, has received less coverage. China might be compelled to act militarily if North Korea was attacked or collapsed on its own. Doing so would protect Beijing’s objectives of securing the border, preventing U.S. forces from nearing the Yalu River, and thwarting the emergence of a united, U.S.-allied democratic Korean state.

The assumption of a default North Korean-Chinese alliance is a legacy of the Cold War, and has often led to false assumptions about Beijing’s priorities. One major question is whether China would come to Kim's aid in the event of war. After all, how would many of China’s citizens and military brass, having been fed a steady diet of nationalism, react if Beijing failed to protect its ally? However, others have maintained that China would keep out of the conflict since Kim has become more of a liability to Beijing. China’s leadership prizes stability and therefore would not risk $825.38 billion worth of trade with the United States and South Korea, let alone a nuclear war.

What a War Between NATO and Russia Would Look Like.

The degree of China’s loyalty to North Korea is a good question. But it is better to ask what China would do if its core national interests were threatened and there was no trusted plan in place among Beijing, Washington and Seoul that addressed its concerns.

The first and most intuitive concern for China would be to contain the flow of North Korean refugees that would spill across the border. North Korea is a fragile state home to over twenty-five million people, many of whom have been living under conditions of extreme starvation, poverty, oppression and brainwashing. In the past, Beijing has had to deal with an influx of around two hundred thousand North Korean refugees. More recently, it has increased its border patrols and fences, often cooperating with North Korean authorities in trying to find and forcibly repatriate escapees. A war would likely kill hundreds of thousands to millions, which would increase large-scale flight.

What a War Between America and China Would Look Like.

From China’s point of view, refugees would become a nightmare of vast humanitarian demands requiring immense resources in food, shelter and medical attention. A sudden flood of refugees who do not speak Chinese into China’s industrial northeast would create strains on local governments and markets, causing unrest or ethnic strife. This means that at the least, China would likely create a military buffer zone to manage or stop refugees. Alternatively, it could also occupy part or all of the DPRK to keep North Koreans in their own country. Either way, China has trained its military for such operations.

Another problem Beijing faces is the question of who would take control of North Korea’s nuclear weapons if the government collapsed. This is something U.S. policymakers have long worried about and is another reason for why military action is risky. One of the problems is that it is difficult to discern whether every nuclear site in North Korea is known, mapped and able to be destroyed or captured quickly since many of the country’s facilities are underground and many missiles are on mobile launchers. Given that most of North Korea’s nuclear sites are located along the Chinese border, the necessity to act also increases in the face of possible U.S. intervention.

The location of Kim’s nuclear sites is alarming for China since it means that if the United States ever wanted to take out his nuclear capabilities, then U.S. troops would have to cross the thirty-eighth parallel and approach the Yalu River. Needless to say, countries do not like the forces of other powers on their borders. During the Korean War, Beijing came to North Korea’s aid largely to protect itself from the possibility of U.S. forces marching into China. After Beijing entered the war, Gen. Douglas MacArthur actively argued that America should have invaded, and even called for the use of nuclear weapons. In addition to the sensitive legacy of the Korean War, China has a long history of intervening in Korea when foreign powers have come too close to their borders. It would be highly out of character for Beijing to react to U.S. forces near the Yalu River in a nonmilitary fashion.

What a War Between China and Japan Would Look Like.

Finally, Beijing would likely assume that a post-North Korean world would be harmful to its core interests, especially if the peninsula were to be administered by a U.S.-allied South Korea. The two countries have often worked under the assumption that both Koreas would eventually be reunited. Seoul’s Ministry of Unification has been planning for such a goal, intending to absorb North Korea into its democratic and capitalist fold much as East Germany was annexed by West Germany in 1990. Given South Korea’s aging population and the fact that reunification would likely cost $1.13 to $3.2 trillion, Seoul would want to maintain at least a minimal U.S. defense alliance as a way to subsidize a reduction in defense spending. Furthermore, South Korea would still have historically antagonistic neighbors to worry about, including, obviously, China.

A world without North Korea would be dangerous for Beijing. Though China would be happy that South Korea would take on the economic burden of reunification, a united and U.S.-allied Korea would still give American troops access to the Yalu River. Washington might withdraw its troops, but it might not. One may recall that many thought the United States would leave Europe and NATO would end after the Cold War, but much to Russia’s chagrin that did not happen. China knows this and remembers that lesson in realpolitik.

Yet another source of trouble facing China, is that a united Korea would be one more example of a democratic, Western country whose values would collide with the Chinese communist leadership’s goals of maintaining a one party, state-capitalist system. Authoritarian countries do not like shining democratic cites on a hill, particularly if that hill is right next door for their citizens to see. After all, Russia reacted with force when Ukraine attempted to make further democratic progress and align with the West through a deal with the European Union. It should be of no surprise to suggest that the ruling elites of Beijing would react vigorously if faced with the prospect of a unified, democratic and U.S.-aligned Korea.

China has been preparing for a partial or complete intervention into North Korea for years now. Relations between Beijing and Pyongyang are at an all-time low and Xi wants to keep all options on the table. To that end, China has continued to practice intervention war games and has even undertaken attempts at revisionist history such as the Northeastern Project. That so-called academic project claims that the ancient Korean kingdom of Koguryo (which happens to include all of present-day North Korea and most of South Korea) was really a part of ancient China and therefore Korea’s territorial inheritance actually historically belongs to China. Indeed, such claims were even repeated by President Xi to Trump.

During off-the-record interviews with U.S. researchers, several high-level Chinese military and government officials have made it clear that if the crisis was dire enough, Beijing would most certainly intervene—either to annex North Korea or to prop up a new puppet state. A Chinese intervention into North Korea carries many risks and is therefore an option of last resort. If Beijing decides to send in Chinese forces, they will do so in a way that tries to minimize the cost. It is important to note that interventions can come in many forms, but in all of them China’s goals remain same.

If North Korea ever collapsed, an intervention would be framed as a humanitarian and stabilization mission. One can expect an attempt to gain UN Security Council approval along those lines from China's ambassador at the same moment as the first Chinese units roll across the border. Diplomatic maneuvers in the UN could also be used to veto any United States or South Korean resolutions in favor of their own intervention or reunification. In a scenario where North Korea is attacked, China would intervene as an ally and to save face domestically. Alternatively, if North Korea attacked America or South Korea first, then China would will intervene, but in a more limited fashion. Beijing knows a war of choice on the side of the aggressor would not be worth the price, and so China has made it clear that it would not come to North Korea’s aid if Kim started a war. Therefore, Beijing will still act, but it will instruct its forces to avoid American and South Korean forces and will signal to the United States that it wants to secure its border, not to fight.