BEIJING (Reuters) - China recently played host to a Taliban delegation as part of efforts to promote peace and reconciliation in Afghanistan, China’s foreign ministry said on Thursday.

Representatives of the Taliban, who have been fighting for years to expel foreign forces and defeat the U.S.-backed government in Kabul, have been holding talks with U.S. diplomats for months.

The focus has been the Taliban demand for the withdrawal of U.S. and other foreign forces, in exchange for guarantees that Afghanistan will not be used as a base for militant attacks.

Taliban negotiators have also met senior Afghan politicians and civil society representatives, including in Moscow recently, as part of so-called intra-Afghan dialogue to discuss their country’s future.

Chinese foreign ministry spokesman Lu Kang told a daily news briefing that Abdul Ghani Baradar, the Taliban representative in Qatar, and some of his colleagues had recently visited China, though he did not say exactly when.

Chinese officials met them to discuss the Afghan peace process and counter-terror issues, Lu told the briefing, without saying who met the delegation.

“China pays great attention to the evolving situation in Afghanistan in recent years. We have always played a positive role in the Afghan peace and reconciliation process,” Lu said.

China supports Afghans resolving their problems themselves through talks, and this visit was an important part of China promoting such peace talks, he said.

“Both sides believe that this exchange was beneficial and agreed to keep in touch about and cooperate on continuing to seek a political resolution for Afghanistan and fighting terrorism.”

China’s far western Chinese region of Xinjiang shares a short border with Afghanistan.

China has long worried about links between militant groups and what it says are Islamist extremists operating in Xinjiang, home to the mostly Muslim Uighur people, who speak a Turkic language.

China, a close ally of Pakistan, has been deepening its economic and political ties with Kabul and is also using its influence to try to bring the two uneasy neighbors closer.

The Chinese government’s top diplomat, State Councillor Wang Yi, visited Kabul last December.