But Chinese foreign ministry spokeswoman Hua Chunying on Tuesday said Washington had left “an awful mess of unrest, division and broken families” in Afghanistan.

“America’s strength and role is destruction, not construction,” Hua said at a regular press briefing.

China shares a rugged 76-kilometre (47-mile) border with Afghanistan.

Beijing has long feared the neighbour could become a staging point for minority Uyghur separatists in the sensitive border region of Xinjiang.

But a top-level Taliban delegation met with Chinese foreign minister Wang Yi in Tianjin last month, promising that Afghanistan would not be used as a base for militants.

In exchange, China offered economic support and investment for Afghanistan’s reconstruction.

Hua on Monday said China was ready to continue “friendly and cooperative” relations with Taliban-controlled Afghanistan.

She urged the new Afghan regime on Tuesday to “make a clean break with international forces” and “prevent Afghanistan from becoming a gathering place for terrorists and extremists again”.

Biden promised a complete withdrawal of US troops by 11 September, marking an end to two decades of war.

But Washington was left shocked by the rapid collapse of the Afghan government and the Taliban’s sweeping advance.

China has repeatedly criticised what it sees as the US’ hasty withdrawal from Afghanistan as a failure of leadership.