When the Taliban took over Afghanistan the first time in 1996, China refused to recognize their rule and left its embassy shut for years. This time around, Beijing has been among the first to embrace the Islamist militants next door.
China's remarkable shift was on display little more than two weeks ago, when Foreign Minister Wang Yi welcomed a Taliban delegation to the northern port of Tianjin as the group made gains against the administration of President Ashraf Ghani, who fled the country on Sunday. Wang's endorsement of the Taliban's "important role" in governing Afghanistan provided a crucial boost of legitimacy for an organization that has long been a global pariah due to its support of terrorism and the repression of women.
China's reasons have as much to do with its own rise as a global power as the Taliban's surprisingly swift march on the Afghan capital. China today commands an economy worth $14.7 trillion -- more than 17 times its size in 1996 -- and a massive trade-and-infrastructure initiative that stretches across the Eurasian landmass.
Beijing's fears about Islamist extremism among its own Uyghur minority have also deepened in recent years, leading it to build a vast police state adjacent to Afghanistan. Moreover, an increasingly intense rivalry with the US has prompted Chinese President Xi Jinping to seize any opportunity to push back against Washington's dominance and push American forces away from his borders.
Those interests make China look like the next great power with a stake in bringing order to Afghanistan as the Taliban prepare to declare an Islamic emirate in Kabul. After the failures of the Soviet Union and now the US, China will be hard-pressed to avoid repeating the same mistakes in a rugged and landlocked nation notorious for exhausting empires.
"Twenty years ago, China wasn't a global power and what was happening in Afghanistan didn't bother China," said Yun Sun, director of the China Program at the Washington-based Stimson Center. "But today, there are so many new factors -- there's the Uyghur issue, there's economic interests and China's self-perception as a global power."
China has sought to portray itself as more pragmatic and less interventionist than the West while urging a negotiated peace. "China hopes the Afghan Taliban can unite with other political parties and with all ethnic groups and build a political framework in keeping with national conditions that is broadly inclusive and will lay the foundation for enduring peace," Foreign Ministry spokeswoman Hua Chunying told reporters Monday in Beijing.
Still, Hua stopped short of endorsing the Taliban's rule, saying only that the situation in Afghanistan had "experienced major changes."
It was all part of a long evolution by China, which once denied any connection with the Taliban before hosting the first delegations from the group in 2013. Now, as Taliban fighters made their entrance into Kabul, posts circulated on China's heavily censored social media comparing the event to Mao Zedong's taking of Beijing in 1949.
Meanwhile, state media gloated over the American withdrawal, with a commentary in the official Xinhua News Agency declaring it the "death knell for declining US hegemony."
"The sound of roaring planes and the hastily retreating crowds mirrored the last twilight of the empire," the piece said.
Even so, China is one of the few countries that saw some benefit from the US's $840 billion nation-building debacle, which bogged down Beijing's rivals while creating a relatively stable environment for its companies. That's left China with economic interests to secure, including a copper mine and several oil blocks. The country evacuated some 200 business people last month.
Afghanistan's stability is key to protecting more than $50 billion worth of Belt-and-Road projects in neighbouring Pakistan that provide an overland route to the Indian Ocean. Fu Xiaoqiang, vice director at China Institutes of Contemporary International Relations, said in a commentary on the think tank's social media account Tuesday that the Afghan chaos has spilled into Tajikistan, as well as Pakistan, and would continue to "implicate the peace along China's western borders."
"It is necessary for China to coordinate its rivalry with the US and the periphery security situation, and allocate resources reasonably," Fu said. Wang, the Chinese foreign minister, told US Secretary of State Antony Blinken in a phone call Monday that the turmoil in Afghanistan highlighted the danger of trying to impose a political system on a foreign culture.
Perhaps no issue is as pressing for Beijing as ensuring that Afghanistan doesn't become a source of extremism that bleeds over the border. Wang pressed chief Taliban negotiator Mullah Abdul Ghani Baradar during their July 28 meeting to make a "clean break" with the East Turkestan Islamic Movement.
China blames the group, which had reportedly operated in Afghanistan during the Taliban's last period in control, for terrorist attacks it has cited to justify crackdowns in the Xinjiang region that the US and others say amount to genocide. Baradar pledged that the Taliban would never allow any force to use Afghan territory to engage in acts detrimental to China, according to the Chinese statement.
Similarly, Wang urged Blinken during their call to reverse the Trump administration's decision to remove ETIM from its list of designated terrorist organizations. The Bush administration had granted China's demand for the designation in 2002 while seeking Beijing's cooperation with its War on Terror, including the Afghanistan action.
"China's attitude toward a Taliban-led regime will depend on its policies, for instance, whether the Taliban will honour its promises and not to become a hotbed for extreme forces that have links to China," said Fan Hongda, a professor at the Middle East Studies Institute of Shanghai International Studies University.
Afghanistan could become the biggest test yet of a Chinese diplomatic model that's driven by loans, commodities and infrastructure deals rather than demands for liberal policies. If the Taliban pursue moderate policies toward women that don't alienate other nations and achieves political stability, Beijing might consider an array of investments similar to what it has done in Pakistan, according to Sun, of the Stimson Center.
"The Chinese approach is, 'Through economic infusion we create roads, we create infrastructure, and we make sure everyone has jobs,'" she said. "And if everyone goes to work at nine in the morning and comes home at 6 p.m., they don't have time to think about terrorism."
Disclaimer: This article first appeared on Bloomberg.com and is published under a special syndication arrangement.