BEIJING (Reuters) - China is to set up an anti-terrorism alliance with Pakistan, Afghanistan, and Tajikistan, state media said on Thursday, as it seeks to boost coordination with neighbors to tackle what it says is a growing domestic militant threat.

Fang Fenghui, a member of the powerful Central Military Commission which controls China’s armed forces, hosted a meeting with his counterparts on Wednesday in Urumqi, capital of the western Xinjiang region, where officials say they are battling Islamist militants.

The four countries recognized the serious threat of terrorism and extremism to regional stability, the official Xinhua news agency said, and they agreed to set up a “four-country mechanism” for intelligence sharing and training.

“All parties reaffirmed they will cooperate to respond to these forces, and safeguard all member countries’ peace and stability,” Xinhua said.

Afghan army chief of general staff, General Qadam Shah Shaheem, Pakistani army chief General Raheel Sharif, and the Chief of General Staff of the Tajikistan armed forces, Major General E. A. Cobidrzoda, took part in the talks, the news agency said.

The meeting comes after China’s defense minister this week thanked Afghanistan’s Shaheem for support in fighting the East Turkestan Islamic Movement (ETIM) an Islamist group that China says wants to set up a separate state in Xinjiang.

China did not elaborate on the help it got.

China has long been concerned that instability in Afghanistan will spill over into violence-prone Xinjiang, home to the Muslim Uighur people, where hundreds of people have died in recent years in unrest Beijing blames on extremists.

The United States and the United Nations have listed ETIM as a terrorist group, though some experts have questioned its cohesiveness and say China’s policies in Xinjiang have contributed to unrest.

China denies that its policies stoke tension in Xinjiang or motivate Uighurs to join Islamic State militants, though it acknowledges some have gone to Syria and Iraq to join the group.

China is also working with Pakistan and the United States to broker peace talks to end a Taliban insurgency that has raged for 15 years in Afghanistan.

That effort never got beyond exploratory talks and appeared to break down completely when Taliban leader Mullah Akhtar Mansour was killed in a U.S. drone strike in Pakistan in May.

Sources in the Taliban told Reuters that a Taliban delegation visited China in July, though Chinese officials have not confirmed it.