HANGZHOU, China (Reuters) - Chinese President Xi Jinping and his Turkish counterpart Tayyip Erdogan agreed on Saturday to deepen counter-terror cooperation, as the two set aside previous disagreements over China’s treatment of a Turkic-speaking Muslim minority.

Chinese President Xi Jinping (right) shakes hands with Turkish President Recep Tayyip Erdogan before their meeting at the West Lake State Guest House on September 3, 2016 in Hangzhou, China. REUTERS/Lintao Zhang/Pool - RTX2NY4O

Hundreds, possibly thousands, of Uighurs keen to escape unrest in China’s western Xinjiang region have travelled clandestinely via Southeast Asia to Turkey, where many see themselves as sharing religious and cultural ties.

Beijing says some Uighurs then end up fighting with militants in Iraq and Syria.

But Ankara vowed last year to keep its doors open to Uighur migrants fleeing what rights activists have called religious persecution in China. Beijing denies accusations that it restricts the Uighurs’ religious freedoms.

Meeting on the sidelines of the G20 summit in the eastern Chinese city of Hangzhou, Xi told Erdogan he appreciated Turkey stressing that it would not allow its territory to be used for acts that harmed China’s security.

China “hopes both sides can achieve even more substantive results in counter-terrorism cooperation”, China’s state-run Xinhua news agency cited Xi as saying.

Erdogan, in comments before reporters translated from Turkish into Chinese, said the emphasis should be on strengthening their ties.

“Fighting terrorism is a long-term issue, and is also a long-term topic discussed by the G20,” he said.

Xinhua also quoted Erdogan as thanking China for its help in maintaining Turkey’s security and stability, and that he hoped for greater counter-terrorism cooperation.

Turkey, a NATO member and part of the U.S.-led coalition against Islamic State, has seen a series of deadly bombings this year blamed on the radical Islamists. But it also fears Kurdish militias in Syria will seize a swathe of border territory and embolden Kurdish insurgents on its own soil.

Beijing blames Islamist militants, including those it says come from a group called the East Turkestan Islamic Movement (ETIM), for a rise in violence in Xinjiang in recent years in which hundreds have died.

Rights groups say the unrest there is more a reaction to repressive government policies, and experts have questioned whether ETIM exists as a cohesive militant group.

Officials in Xinjiang have stepped up regulations banning overt signs of religious observance, like veils or beards.

Turkey angered China by expressing concern about reports of restrictions on Uighurs worshipping and fasting during the holy month of Ramadan last year, and Turkish protesters have marched on China’s embassy and consulate in Turkey over Beijing’s treatment of Uighurs.

The two countries have also jousted over Thailand’s deportation of Uighur migrants back to China.