The inner workings of a network of centres where at least one million mostly Muslim ethnic Uighurs are thought to be detained have been revealed in a cache of secret documents that show how China's government selects people for detention and how they are then controlled once inside.
The classified documents were obtained and verified by the International Consortium of Investigative Journalists and shared with other international media including the Associated Press and give the most significant insight yet into how the mass detention camps work.
The papers lay out the Chinese government's strategy to lock up minorities, most of whom are Muslims, to rewire their thoughts and even the language they speak.
The documents stipulate watch towers, double-locked doors and video surveillance "to prevent escapes" and describe an elaborate scoring system that grades detainees on how well they speak the dominant Mandarin language, memorise ideology, and adhere to strict rules on everything, down to bathing and using the toilet.
"It's a completely Orwellian system of ethnic cleansing, where China is acting as big brother," human rights lawyer Arsalan Iftikhar told Al Jazeera.
Liu Xiaoming, China's ambassador to the United Kingdom, dismissed the papers as "pure fabrications".
Use of technology
The United Nations says at least one million ethnic Uighurs and other Muslims have been detained in the camps that China describes as "vocational training centres" to stamp out "hardline groups" and give people new skills.
The documents show how data and artificial intelligence are being used for social control.
With the help of mass surveillance technology, computers were able to issue the names of tens of thousands of people for interrogation or detention in just one week, including university students and party officials.
Experts say the documents spell out a vast system that targets, watches and grades entire ethnicities to forcibly assimilate them - especially Uighurs, a Turkic minority of about 10 million with its own language and culture.
"We have an unprecedented insight into what the Chinese government is really doing," said Adrian Zenz, a leading security expert in the far western region of Xinjiang.
China has struggled for decades to control Xinjiang, where hundreds of people, including Uighurs and Han Chinese, have died in violent attacks, reprisals and race riots.
In 2014, Chinese President Xi Jinping launched what he called a "People's War on Terror" in response to attacks carried out by "radical" Uighur militants.
In late 2016, the crackdown intensified dramatically when Xi named Chen Quanguo, a hardline official transferred from Tibet, as Xinjiang's new head.
Most of the documents were issued in 2017.
The Chinese government says its methods have worked.
"It is precisely because of a series of preventive counterterrorism and de-extremism measures taken in a timely manner that Xinjiang ... has not seen a single terrorist incident for three years," Foreign Ministry spokesman Geng Shuang said.
The documents came from an anonymous source, and the consortium verified them by consulting experts, cross-checking content and comparing signatures.
They consist of a notice with guidelines for the camps, four bulletins on how to use technology to target people, and a court case sentencing a local Uighur party official to 10 years in prison for telling colleagues not to say dirty words, watch porn or eat without praying.
Issued to rank-and-file officials by the powerful Xinjiang Communist Party Political and Legal Affairs Commission, the documents support what has been learned about the camps from the testimony of Uighurs and Kazakhs, satellite imagery and highly restricted visits by journalists to the region.
The documents show direct links between the internment camps and the extreme digital surveillance in Xinjiang.
One document states that the purpose of the surveillance is "to prevent problems before they happen".
This is done through a system called the Integrated Joint Operations Platform, or IJOP, built by a state-owned military contractor.
The IJOP flagged the names of people considered suspicious for behaviour that includes fleeing the country, asking others to pray or using phone apps that cannot be monitored by the government.
People considered suspicious were then called in for questioning and funnelled into different parts of the system, from house arrest to detention centres with three levels of monitoring to prison.
Once inside, the documents show, detainees are subject to forced indoctrination.
The first item listed as part of the curriculum is ideological education.
It is partly rooted in the ancient Chinese belief in transformation through education - taken before to terrifying extremes during the mass-thought reform campaigns of Mao Zedong's Cultural Revolution.
The indoctrination goes along with "manner education", where behaviour is dictated, including ensuring "timely haircuts and shaves", "regular change of clothes" and "bathing once or twice a week".
The tone, experts say, echoes a general perception by the Han Chinese government that Uighurs are prone to violence and need to be civilised.
In practice, this meant that the detainees daily lives were regimented to an extreme and intrusive degree.
"We had to talk to a speaker to get permission to go to toilet," said former detainee Gulbakhar Jalilova, adding that there were only 10 minutes allotted every hour for her and her cellmates to go to the toilet.
"Some of us were able to go in this time, and some weren't."
Detainees are frequently tested on Mandarin, ideology and discipline, and their scores feed into a point system tracked by computer.
Those who do well are rewarded with family visits and early graduation, and those who do poorly are to be sent to a stricter "management area" with longer detention times.
Students go for "vocational skills improvement" only after at least one year of learning ideology, law and Mandarin.
After they leave, the documents say, every effort should be made to get them jobs.
Some detainees describe being forced to sign work contracts for low pay.
According to Zenz, it was "a cultural genocide, and... coercive social re-engineering".
"The end game is to change an entire minority population," he added.