A senior UN official visited the restive far western Chinese region of Xinjiang this week.

China and the United Nations have reached a "broad consensus" about counter-terror work, China's Foreign Ministry said on Sunday after a controversial visit by a senior UN official to the restive far western Chinese region of Xinjiang this week.

The United States and other western countries objected to a visit by the UN counterterrorism chief to Xinjiang, where UN experts say some one million ethnic Uighurs and other Muslims are held in detention centres.

Diplomats said that along with the United States several other countries, including Britain, complained about the trip of Vladimir Voronkov, a veteran Russian diplomat who heads the UN Counterterrorism Office.

US Deputy Secretary of State John Sullivan spoke with UN Secretary-General Antonio Guterres on Friday "to convey deep concerns" about Voronkov's trip because "Beijing continues to paint its repressive campaign against Uighurs and other Muslims as legitimate counterterrorism efforts when it is not".

In a brief statement, China's Foreign Ministry said that Voronkov had visited Beijing and Xinjiang from June 13-15, meeting senior diplomats including Vice Foreign Minister Le Yucheng.

The two sides "had a deep exchange of views on the international counter-terrorism situation and counter-terrorism cooperation between China and the United Nations, and reached a broad consensus", the ministry said, without giving details.

China and the world need to stand together to fight terror, and China supports the work of the United Nations Counter-Terrorism Office, the statement added.

China has been condemned internationally for setting up the detention complexes, which it describes as "education training centres" helping to stamp out extremism and give people new skills.

Voronkov visited Xinjiang before U.N. human rights chief Michelle Bachelet, who has repeatedly pushed China to grant the United Nations access to investigate reports of disappearances and arbitrary detentions, particularly of Muslims in Xinjiang.

Guterres raised the plight of Muslims in China's Xinjiang region with the Chinese government's top diplomat, State Councillor Wang Yi, during a visit to Beijing in April.

Chinese President Xi Jinping has been in the Central Asian state of Kyrgyzstan and Tajikistan over the past few days, where he has spoken of the importance of fighting extremism and terror.