GENEVA — China fumed this week after 22 mostly Western countries rebuked its mass detention of Muslims in the restive Xinjiang region. On Friday the Chinese delivered their answer: praise from even more countries saying China has made Xinjiang safe and happy.

Ambassadors of 37 states from Asia, Africa, the Middle East and Latin America jointly signed a letter to the president of the United Nations Human Rights Council praising China’s “contribution to the international human rights cause.”

The states, including prominent members of the Organization of Islamic Cooperation, such as Pakistan and Saudi Arabia, said China had faced terrorism, separatism and religious extremism in Xinjiang, the vast northwest region that is mainly Muslim. But through counterterrorism measures and vocational training, these states said, China had restored peace and security there.

“We note with appreciation that human rights are respected and protected in China in the process of counterterrorism and de-radicalization,” they said.