No doubt the Chinese government is enjoying a good laugh at US humiliation in Afghanistan. But it knows it has more reason to cry.
Watching chaotic failure by the country seen as China's chief rival can only be satisfying in Beijing. Yet China has been a beneficiary of exclusion of the Taliban from power in Afghanistan over the past two decades. It must now worry that extremists could again emerge in that neighbouring country.
And Beijing can't be pleased in seeing Washington get rid of one of the distractions that take US money, forces and attention away from the western Pacific.
At this early stage, we can rule out one notion that's been running around since President Joe Biden announced in April that the US would withdraw - the idea that China will move into Afghanistan on a large scale to exploit it economically, filling the vacuum. No, China's not that stupid.
Since there's a risk that the Taliban will let Islamic extremists develop in Afghanistan and use it as a base, as it did in the 1990s, Beijing's greatest worry will be that its neighbour could export terrorism into Xinjiang. This traditionally Muslim province of China, where the Chinese Communist Party commits massive human rights abuses to ensure its complete control, has a short border with Afghanistan.
In fact, the CCP is probably worrying too much about this danger, since it now exercises so much control in Xinjiang that foreign extremists are unlikely to cause much trouble there. And the border is short and its approaches are narrow, so keeping an eye on movements is relatively easy.
But domestic stability is always the CCP's overwhelming priority, since it equates to the stability of the party's position.
Next, China has to worry about extremism spreading from Afghanistan to other countries in central Asia, because the region offers access to Europe and the Middle East that can't be blocked by the US Navy.
The Central Asia-China Gas Pipeline, for example, carries natural gas from one country that borders Afghanistan, Turkmenistan, though another, Uzbekistan. Then it goes through Kazakhstan and on to China.
The rail link between China and Europe passes through Russia and Kazakhstan, a stable country that nonetheless worries a lot about Islamic extremism.
China, reasonably enough, doesn't want to be dependent on Russia for international access, so it's developing another westward rail route. This will go through Uzbekistan, Turkmenistan and Iran - all of which would be right next to any festering source of instability that could emerge in Afghanistan.
Without these communications lines, China's international supplies are largely at the mercy of the US Navy. The Chinese navy is now huge, but in war it would have no hope of protecting shipping routes even in the relatively close Indian Ocean, the terminus for its other possible land links (which go through south-east Asia and Pakistan).
Strategists in Beijing have to worry about how to bypass a blockade not just during a possible war with the US, but also in the period of diplomatic hostility that would follow one. And China's international behaviour could provoke blockade even without a war.
So, 20 years of Western and especially US efforts at keeping Afghanistan stable have been very much to China's advantage.
Next, if the US is busy in wars away from the western Pacific, it's burning resources that could otherwise be used in resisting China. Apart from the obvious resources of money and forces, these include intelligence, diplomatic effort and simply the attention of political and military leaders.
The mess in the Middle East and Afghanistan that the US has been struggling with since 2001 - or, more accurately, since the Iraqi invasion of Kuwait in 1990 - has distracted Washington during the very time that China has risen from minor strategic importance to becoming a first-order threat.
This has more than compensated for the discomfort felt in Beijing in seeing US forces just over its border in Afghanistan.
Admittedly, the US had only 2500 troops officially in Afghanistan when Biden announced the pullout. Even allowing for undisclosed forces, plus the air, sea and intelligence support behind the people on the ground, the monetary cost of the deployment was no longer great for Washington.
More importantly, withdrawal removes the risk of the US and its friends ramping up their presence again. And, frankly, the chaos and embarrassment of the withdrawal further reduces the already diminished chance of the US again committing major forces to anywhere in that part of the world.
Washington will now be more focused on restraining China, and particularly on the problem of how to stop it from seizing Taiwan.
As for the theory of China filling the vacuum in Afghanistan, there's no vacuum to fill: the country painfully repels outsiders. The Chinese can see that as well as anyone. Yes, there are mineral resources in Afghanistan, but there are resources elsewhere, too.
The CCP has special reasons for avoiding the place. For the past few years it's been telling the Chinese people that their country (by which it means their party) will protect them abroad.
Well, imagine a situation in which two buses with 100 Chinese mine workers were captured by militants in Afghanistan. The Chinese people would be outraged. The CCP would absolutely have to free the hostages. If it sent in helicopters and special forces and succeeded, it would win great praise from the populace.
If the rescue mission were a disaster, like the one that the US attempted in Iran in 1980, the people would be furious with their government's incompetence.
None of this is intended to downplay the tragedy of the mess in Afghanistan. But there's plenty of reason for dissatisfaction in Beijing, too.
- Bradley Perrett was based in Beijing as a journalist from 2004 to 2020.
- This article is supported by the Judith Neilson Institute for Journalism and Ideas.