This photo taken on June 4, 2019 shows the Chinese flag flying over the Juma mosque in the restored old city area of Kashgar, in China's western Xinjiang region. Greg Baker | AFP | Getty Images

The watch towers, double-locked doors and video surveillance in the Chinese camps are there "to prevent escapes." Uighurs and other minorities held inside are scored on how well they speak the dominant Mandarin language and follow strict rules on everything down to bathing and using the toilet, scores that determine if they can leave. "Manner education" is mandatory, but "vocational skills improvement" is offered only after a year in the camps. Voluntary job training is the reason the Chinese government has given for detaining more than a million ethnic minorities, most of them Muslims. But a classified blueprint leaked to a consortium of news organizations shows the camps are instead precisely what former detainees have described: Forced ideological and behavioral re-education centers run in secret. The classified documents lay out the Chinese government's deliberate strategy to lock up ethnic minorities even before they commit a crime, to rewire their thoughts and the language they speak. The papers also show how Beijing is pioneering a new form of social control using data and artificial intelligence. Drawing on data collected by mass surveillance technology, computers issued the names of tens of thousands of people for interrogation or detention in just one week. Taken as a whole, the documents give the most significant description yet of high-tech mass detention in the 21st century in the words of the Chinese government itself. Experts say they spell out a vast system that targets, surveils and grades entire ethnicities to forcibly assimilate and subdue them -- especially Uighurs, a predominantly Muslim Turkic minority of more than 10 million people with their own language and culture. "They confirm that this is a form of cultural genocide," said Adrian Zenz, a leading security expert on the far western region of Xinjiang, the Uighur homeland. "It really shows that from the onset, the Chinese government had a plan." Zenz said the documents echo the aim of the camps as outlined in a 2017 report from a local branch of the Xinjiang Ministry of Justice: To "wash brains, cleanse hearts, support the right, remove the wrong." China has struggled for decades to control Xinjiang, where the Uighurs have long resented Beijing's heavy-handed rule. After the 9/11 attacks in the United States, Chinese officials began justifying harsh security measures and religious restrictions as necessary to fend off terrorism, arguing that young Uighurs were susceptible to the influence of Islamic extremism. Hundreds have died since in terror attacks, reprisals and race riots, both Uighurs and Han Chinese. In 2014, Chinese President Xi Jinping launched what he called a "People's War on Terror" when bombs set off by Uighur militants tore through a train station in Urumqi, the capital of Xinjiang, just hours after he concluded his first state visit there. "Build steel walls and iron fortresses. Set up nets above and snares below," state media cited Xi as saying. "Cracking down severely on violent terrorist activities must be the focus of our current struggle." In 2016, the crackdown intensified dramatically after Xi named Chen Quanguo, a hardline official transferred from Tibet, as Xinjiang's new head. Most of the documents were issued in 2017, as Xinjiang's "War on Terror" morphed into an extraordinary mass detention campaign using military-style technology. The practices largely continue today. The Chinese government says they work. "Since the measures have been taken, there's no single terrorist incident in the past three years," said a written response from the Chinese Embassy in the United Kingdom. "Xinjiang is much safer. ...The so-called leaked documents are fabrication and fake news." The statement said that religious freedom and the personal freedom of detainees was "fully respected" in Xinjiang. When asked about the documents on Monday, Chinese Foreign Ministry spokesman Geng Shuang reiterated that issues surrounding Xinjiang are "purely China's internal affairs." "Some media used underhanded tricks to sensationalize the Xinjiang issue," Geng said during a regular news briefing. "The plot to smear and slander China's anti-terrorism and deradicalization efforts in Xinjiang will not prevail." The documents were given to the International Consortium of Investigative Journalists by an anonymous source. The ICIJ verified them by examining state media reports and public notices from the time, consulting experts, cross-checking signatures and confirming the contents with former camp employees and detainees. 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 Uighur Communist Party member to 10 years in prison for telling colleagues not to say dirty words, watch porn or eat without praying. The documents were issued to rank-and-file officials by the powerful Xinjiang Communist Party Political and Legal Affairs Commission, the region's top authority overseeing police, courts and state security. They were put out under the head official at the time, Zhu Hailun, who annotated and signed some personally. The documents confirm from the government itself what is known about the camps from the testimony of dozens of Uighurs and Kazakhs, satellite imagery and tightly monitored visits by journalists to the region. Erzhan Qurban, an ethnic Kazakh who moved back to Kazakhstan, was grabbed by police on a trip back to China to see his mother and accused of committing crimes abroad. He protested that he was a simple herder who had done nothing wrong. But for the authorities, his time in Kazakhstan was reason enough for detention. Qurban told the AP he was locked in a cell with 10 others last year and told not to engage in "religious activities" like praying. They were forced to sit on plastic stools in rigid postures for hours at a time. Talk was forbidden, and two guards kept watch 24 hours a day. Inspectors checked that nails were short and faces trimmed of mustaches and beards, traditionally worn by pious Muslims. Those who disobeyed were forced to squat or spend 24 hours in solitary confinement in a frigid room. "It wasn't education, it was just punishment," said Qurban, who was held for nine months. "I was treated like an animal."

Who gets rounded up and how?

On February 18, 2017, Zhu, the Han Chinese official who signed the documents, stood in chilly winter weather atop the front steps of the capital's city hall, overlooking thousands of police in black brandishing rifles. "With the powerful fist of the People's Democratic Dictatorship, all separatist activities and all terrorists shall be smashed to pieces," Zhu announced into a microphone. With that began a new chapter in the state's crackdown. Police called Uighurs and knocked on their doors at night to take them in for questioning. Others were stopped at borders or arrested at airports. In the years since, as Uighurs and Kazakhs were sent to the camps in droves, the government built hundreds of schools and orphanages to house and re-educate their children. Many of those who fled into exile don't even know where their children or loved ones are. The documents make clear that many of those detained have not actually done anything. One document explicitly states that the purpose of the pervasive digital surveillance is "to prevent problems before they happen" -- in other words, to calculate who might rebel and detain them before they have a chance. This is done through a system called the Integrated Joint Operations Platform or IJOP, designed to screen entire populations. Built by a state-owned military contractor, the IJOP began as an intelligence-sharing tool developed after Chinese military theorists studied the U.S. army's use of information technology in Iraq and Afghanistan. "There's no other place in the world where a computer can send you to an internment camp," said Rian Thum, a Xinjiang expert at the University of Nottingham. "This is absolutely unprecedented." The IJOP spat out the names of people considered suspicious, such as thousands of "unauthorized" imams not registered with the Chinese government, along with their associates. Suspicious or extremist behavior was so broadly defined that it included going abroad, asking others to pray or using cell phone apps that cannot be monitored by the government. The IJOP zoomed in on users of "Kuai Ya," a mobile application similar to the iPhone's Airdrop, which had become popular in Xinjiang because it allows people to exchange videos and messages privately. One bulletin showed that officials identified more than 40,000 "Kuai Ya" users for investigation and potential detention; of those, 32 were listed as belonging to "terrorist organizations." "They're scared people will spread religion through 'Kuai Ya,'" said a man detained after police accused him of using the app. He spoke to the AP on condition of anonymity to protect himself and his family. "They can't regulate it....So they want to arrest everyone who's used 'Kuai Ya' before." The system also targeted people who obtained foreign passports or visas, reflecting the government's fear of Islamic extremist influences from abroad and deep discomfort with any connection between the Uighurs and the outside world. Officials were asked to verify the identities even of people outside the country, showing how China is casting its dragnet for Uighurs far beyond Xinjiang. In recent years, Beijing has put pressure on countries to which Uighurs have fled, such as Thailand and Afghanistan, to send them back to China. In other countries, state security has also contacted Uighurs and pushed them to spy on each other. For example, a restaurateur now in Turkey, Qurbanjan Nurmemet, said police contacted him with videos of his son strapped to a chair and asked him for information on other Uighurs in Turkey. Despite the Chinese government's insistence that the camps are vocational training centers for the poor and uneducated, the documents show that those rounded up included party officials and university students. After the names were collected, lists of targeted people were passed to prefecture governments, who forwarded them to district heads, then local police stations, neighbor watchmen, and Communist Party cadres living with Uighur families. Some former detainees recalled being summoned by officers and told their names were listed for detention. From there, people were funneled into different parts of the system, from house arrest to detention centers with three levels of monitoring to, at its most extreme, prison. Experts say the detentions are a clear violation of China's own laws and constitution. Margaret Lewis, a professor of Chinese law at Seton Hall University, said the Communist Party is circumventing the Chinese legal system in Xinjiang. "Once you're stamped as an enemy, the gloves go off," she said. "They're not even trying to justify this legally....This is arbitrary." The detention campaign is sweeping. A bulletin notes that in a single week in June 2017, the IJOP identified 24,612 "suspicious persons" in southern Xinjiang, with 15,683 sent to "education and training," 706 to prison and 2,096 to house arrest. It is unknown how typical this week might be. Local officials claim far less than a million are in "training," but researchers estimate up to 1.8 million have been detained at one point or another. The bulletins stress that relationships must be scrutinized closely, with those interrogated pushed to report the names of friends and relatives. Mamattursun Omar, a Uighur chef arrested after working in Egypt, was interrogated in four detention facilities over nine months in 2017. Omar told the AP that police asked him to verify the identities of other Uighurs in Egypt. Eventually, Omar says, they began torturing him to make him confess that Uighur students had gone to Egypt to take part in jihad. They strapped him to a contraption called a "tiger chair," shocked him with electric batons, beat him with pipes and whipped him with computer cords. "I couldn't take it anymore," Omar said. "I just told them what they wanted me to say." Omar gave the names of six others who worked at a restaurant with him in Egypt. All were sent to prison.

What happens inside the camps?