BEIJING — America's two-decade presence in Afghanistan was always a mixed bag for neighboring China.
"On the one hand, [China] didn't love the fact that there [were] American military bases literally on their border in Afghanistan," says Raffaello Pantucci, a fellow with the Royal United Services Institute, a security think tank in the United Kingdom. "On the other hand, you know, they thought, well, at least someone is dealing with the issues there. And we don't have to."
That has all changed since the U.S. pullout and Taliban takeover. China must now contend with a fractious Afghanistan along its western border that's led by an extremist Islamist group that has targeted civilians in attacks and provided sanctuary to al-Qaida.
"America's exit lowers strategic pressure on China," says Zhu Yongbiao, an expert on Afghanistan at China's Lanzhou University. "The situation has positives for China, but the negatives outweigh the positives. What China could stand to gain is quite modest."
The swift crumbling of U.S.-trained Afghan forces and the chaotic evacuation of Americans and their Afghan colleagues have given China an opportunity to highlight American failures.
Xinhua, the state news agency, said the fall of Kabul marked the collapse of America's international image and credibility. On Twitter, Hu Xijin, the editor of a nationalistic state newspaper, cited a joke circulating in China that the Taliban's takeover was smoother than the U.S. presidential transition.
But digs aside, the swift U.S. pullout and its aftermath present Beijing — which has kept its Kabul embassy open and functioning — with a set of tough options.
President Biden said the American drawdown in Afghanistan will allow the U.S. to focus more on outcompeting China. And China must now work with not only the Taliban but also with Pakistan — where Chinese interests have come under periodic attack, despite strong Islamabad-Beijing relations — in order to maintain stability along its borders.
Security remains China's primary worry. Beijing is especially concerned that Afghanistan could harbor a resurgence of the East Turkestan Islamic Movement — a name the U.S. and China have used to refer to a loose and scattered effort by Uyghurs outside China to establish an insurgency.
China claims the group encouraged Uyghurs inside China to engage in terrorist acts and trained fighters outside China. Since 2017, Chinese authorities have built a sprawling network of internment camps and prisons in the Xinjiang region to contain hundreds of thousands of ethnic Uyghurs, who Beijing claims are predisposed to terrorism. The U.S. says the effort amounts to genocide.
"Other jihadist groups have begun to take sympathies with the Uyghurs and their plight within China," says Sean Roberts, author of The War on the Uyghurs. "I think that actually the bigger threat to China is outside jihadist groups who may have begun to perceive China as an enemy of Islam."
Beyond security, China's economic hopes for Afghanistan also look dicey for now.
Haiyun Ma, at Frostburg State University in Maryland, says Chinese strategists have long had their eye on Afghanistan as part of China's massive infrastructure project, the Belt and Road Initiative. Afghanistan provides China with a potential path to Iran and Turkey that avoids the Pacific Ocean, where the U.S. and its allies wield power. It also allows China to circumvent Central Asian countries where Russia retains influence.
But Afghanistan's instability makes this strategy aspirational at best. Says Ma: "At this time, I don't really see how China can implement this plan."
China is not yet much of an economic player in Afghanistan. State-owned companies have attempted some investments, including in copper mining in Logar province. But security and other issues have meant no mining has ever begun.
Chinese engagement and aid to Afghanistan have been limited, and Beijing is extremely resistant to the idea of sending peacekeeping forces to Afghanistan to protect its commercial interests.
What Beijing has offered the Taliban so far is an open hand and a hint of legitimacy. In late July, China invited some Taliban leaders to meet Foreign Minister Wang Yi in Beijing. It was a significantly public gesture to demonstrate goodwill toward the insurgent group. In exchange, Taliban leaders pledged to leave Chinese interests in Afghanistan alone and not to harbor any anti-China extremist groups.
This was not the first time China had reached out to the Taliban. Roberts says in the 1990s, Beijing often worked through Pakistani intermediaries with the Taliban, who then ruled the country, to monitor and control Uyghur fighters who had attempted to join al-Qaida.
"The Chinese state is just as happy to work with a democracy as it is with an autocracy, and in this case, perhaps with a theocracy," says Roberts.
Still, Beijing has yet to officially recognize the Taliban as Afghanistan's new leaders. Until there's more stability, as well as clarity about Afghanistan's future, China seems likely to remain on the sidelines.