More than half a century ago, hundreds of thousands of Chinese soldiers died in the Korean War, fighting on the side of their Communist allies against the American-backed South.
Yet today, China finds itself in the uncomfortable position of falling out with both the Communist North and capitalist South of this troublesome peninsula, imposing sanctions on both countries but getting no satisfaction from either.
Yesterday, South Korea announced it would press ahead with the "swift deployment" of an American missile defense system despite relentless and vociferous Chinese opposition.
In February, China said it was cutting off coal imports from North Korea in accordance with sanctions imposed by the United Nations Security Council in a bid to convince the country to abandon its nuclear and missile programme. On Sunday, North Korea ignored China's pleadings not to raise regional tensions by conducting another missile test, albeit one that failed.
China has also deployed an unofficial and unilateral package of sanctions against South Korea to convince it not to deploy an American missile defence system. Yesterday, as US Vice-President Pence warned North Korea not to test US resolve, South Korea's Acting President Hwang Kyo Anh vowed to press ahead with the "swift deployment" of that system, known as Terminal High Altitude Area Defence or THAAD.
"Even before the United States upped the tempo, China was in the unusual position of having really very bad relations with both the North and the South - that's something of an accomplishment," said Euan Graham, director of International Security Programme at the Lowy Institute in Sydney. "Its peninsula policy was in tatters, and things have only got worse since."
China is not alone in struggling to construct a successful policy towards North Korea, as the United States can attest. But the failure of its approach has seldom been more starkly outlined, as Pyongyang presses ahead with its nuclear programme, the United States sends an aircraft carrier strike group to the region and fears of military conflict mount, experts say.
Both Beijing and Washington share the same goal, a peninsula free of nuclear weapons, but they often appear to be trying to realise those goals in mutually incompatible ways.
Under President Barack Obama, the United States tried to isolate and pressurise North Korea economically, an approach which China argues has raised tensions and forced its leader Kim Jong Un - and his father before him - into a corner.
China had banked on a very different approach, believing that building up North Korea's economy would gradually bring about more moderate politics. That, though, has simply given North Korea the resources and the technology to build up its nuclear and missile programmes, experts say.
Nor has it brought Beijing the leverage it desires: Kim has never met Chinese President Xi Jinping and channels of communication between the two governments have never been thinner, experts say.
"China's hope-based approach has encountered Kim Jong Un's 'I'll have my cake and eat it' approach," said Graham. "What's changed in the political relationship is Kim Jong Un's total willingness to humiliate China, to slap it in the face, not to give China even the ritual obeisance his father did."
China believes that having THAAD, with its sophisticated radar and missile defence capabilities, deployed on its doorstep will allow America to spy on it and undermine its own national security interests.
It has whipped up a frenzy of nationalist outrage against South Korea over the issue, with the sale of package tours to the country abruptly stopped in March and tourist numbers plunging. State-run media have called for boycotts of South Korean businesses and goods, and primary schoolchildren have even been encouraged to stage protests of their own. South Korean films were barred from a recent international movie festival in Beijing, and music videos blocked on streaming services.
Lotte, the South Korean conglomerate which turned over land to use for THAAD, has faced huge losses as 87 of its 99 stores have reportedly been closed in China, mostly for ostensibly breaching fire regulations.
But even as Beijing tries to convince Seoul to cancel the deployment of THAAD, Pyongyang shows its utter disregard for China's interests by launching missile after missile, making the case for the defence system ever stronger.
Now, Beijing has a new headache: brinkmanship not just from Kim Jong Un but also from US President Donald Trump, experts say, with the threat of US military action against North Korea now on the table.
There is little doubt this has focused minds in Beijing.
Trump spoke to Xi about North Korea by telephone last week, and now says China is "working with us on the North Korean problem".
But despite its frustration with Pyongyang, is Beijing really prepared to turn up the heat on its old ally?
There appear to be those within the Communist Party who think it should.
The nationalist Global Times newspaper argued in an editorial on Sunday that China should send a clear message to North Korea: if you conduct a sixth nuclear test, we will cut off the vast majority of your oil imports, through stiffer UN sanctions.
Shi Yinhong, professor of international relations at Renmin University of China, says Beijing is "still hesitant" to take such a radical step, one that would threaten the fuel supplies that keeps the North Korean military running.
Indeed, if the United States continues to turn up the heat, with more verbal threats or an even more robust naval presence, China could flip the other way, Shi argues: decide that Washington is the real threat to stability on the peninsula, and "shift from suppressing North Korea to opposing the United States".
Even though coal imports from North Korea appear to have been cut, and Air China cancelled some direct flights from Beijing to Pyongyang from this week, overall imports and exports between the two countries were up sharply in the first quarter of this year, data released by Chinese customs showed.
In the final analysis, some experts say, the legacy of the Korean War, and the survival of the regime China backed at the cost of so much blood, remain paramount.
"China may marginally increase economic pressure on North Korea by cutting down trade, tourist flows or food aide, but its primary goal is to placate Washington," said Yanmei Xie, a politics and foreign policy expert at Gavekal Dragonomics.
"Beijing has reasons and means to discipline Kim, but is more concerned with ensuring the survival of his regime, thus maintaining a buffer against US military presence in the South."