Former inmates have told of the horror after being detained in China's indoctrination camps for Muslims, where they were physically and mentally tortured.

Around 900,000 to one million Muslims are estimated to have been detained in such re-education camps in China's western province of Xinjiang as Beijing tries to clamp down on potential separatist movements.

Omir Bekali and Kayrat Samarkand, both former detainees, have told the Washington Post that these former prisoners have been forced to eat pork and drink alcohol, forbidden in Islam, as punishment.

Omir Bekali cries as he details the psychological stress endured while in a Chinese internment camp. The program aims to rewire detainees' thinking and reshape their identities

The entrance to a jail which locals say is used to hold those undergoing political indoctrination program in Korla in western China's Xinjiang region

Residents walk through a security checkpoint into the Hotan Bazaar where a screen shows Chinese President Xi Jinping in Hotan in western China's Xinjiang region

Hour upon hour, day upon day, Bekali and other detainees in these new indoctrination camps had to disavow their Islamic beliefs, criticise themselves and their loved ones and give thanks to the ruling Communist Party.

When Bekali, a Kazakh Muslim, refused to follow orders each day, he was forced to stand at a wall for five hours at a time. A week later, he was sent to solitary confinement, where he was deprived of food for 24 hours. After 20 days in the heavily guarded camp, he wanted to kill himself.

'The psychological pressure is enormous, when you have to criticise yourself, denounce your thinking - your own ethnic group,' said Bekali in a separate interview with AP as he broke down in tears while describing the camp.

'I still think about it every night, until the sun rises. I can't sleep. The thoughts are with me all the time.'

Since last spring, Chinese authorities in the heavily Muslim region of Xinjiang have ensnared tens, possibly hundreds of thousands of Muslim Chinese - and even foreign citizens - in mass internment camps.

This detention campaign has swept across Xinjiang, a territory half the area of India, leading to what a US commission on China last month said is 'the largest mass incarceration of a minority population in the world today'.

Chinese officials have largely avoided comment on the camps, but some are quoted in state media as saying that ideological changes are needed to fight separatism and Islamic extremism.

Radical Muslim Uighurs have killed hundreds in recent years, and China considers the region a threat to peace in a country where the majority is Han Chinese.

The internment programme aims to rewire the political thinking of detainees, erase their Islamic beliefs and reshape their very identities. The camps have expanded rapidly over the past year, with almost no judicial process or legal paperwork.

Detainees who most vigorously criticise the people and things they love are rewarded, and those who refuse to do so are punished with solitary confinement, beatings and food deprivation.

Omir Bekalic, center, prepares to pray at a mosque in Almaty. Since 2016, Chinese authorities have ensnared tens, possibly hundreds of thousands of Muslim Chinese, in internment camps.

Omir Bekali holds up a mobile phone showing a photo of his parents whom he believes have been detained in China, in Almaty, Kazakhstan

The recollections of Bekali, a heavyset and quiet 42-year-old, offer what appears to be the most detailed account yet of life inside so-called re-education camps.

The Associated Press also conducted rare interviews with three other former internees and a former instructor in other centers who corroborated Bekali's depiction. Most spoke on condition of anonymity to protect their families in China.

Bekali's case stands out because he was a foreign citizen, of Kazakhstan, who was seized by China's security agencies and detained for eight months last year without recourse. Although some details are impossible to verify, two Kazakh diplomats confirmed he was held for seven months and then sent to re-education.

The detention programme is a hallmark of China's emboldened state security apparatus under the deeply nationalistic, hard-line rule of President Xi Jinping.

It is partly rooted in the ancient Chinese belief in transformation through education - taken once before to terrifying extremes during the mass thought reform campaigns of Mao Zedong, the Chinese leader sometimes channelled by Xi.

'Cultural cleansing is Beijing's attempt to find a final solution to the Xinjiang problem,' said James Millward, a China historian at Georgetown University.

Rian Thum, a professor at Loyola University in New Orleans, said China's re-education system echoes some of the worst human rights violations in history.

'The closest analogue is maybe the Cultural Revolution in that this will leave long-term, psychological effects,' Thum said. 'This will create a multigenerational trauma from which many people will never recover.'

Asked to comment on the camps, China's Foreign Ministry said it 'had not heard' of the situation.

When asked why non-Chinese had been detained, it said the Chinese government protects the rights of foreigners in China and they should also be law-abiding. Chinese officials in Xinjiang did not respond to requests for comment.

However, bits and pieces from state media and journals show the confidence Xinjiang officials hold in methods that they say work well to curb religious extremism.

A child rests near the entrance to the mosque where a banner in red reads 'Love the party, Love the country' in the old city district of Kashgar in western China's Xinjiang region

Residents transport goods past a mural depicting current and past top Chinese leaders including Chinese President Xi Jinping at right and Mao Zedong at left in Hotan in Xinjiang

China's top prosecutor, Zhang Jun, urged Xinjiang's authorities this month to extensively expand what the government calls the 'transformation through education' drive in an 'all-out effort' to fight separatism and extremism.

In a June 2017 paper published by a state-run journal, a researcher from Xinjiang's Communist Party School reported that most of 588 surveyed participants did not know what they had done wrong when they were sent to re-education. But by the time they were released, nearly all - 98.8 percent- had learned their mistakes, the paper said.

Transformation through education, the researcher concluded, 'is a permanent cure.'

On the chilly morning of March 23, 2017, Bekali drove up to the Chinese border from his home in Almaty, Kazakhstan, got a stamp in his Kazakh passport and crossed over for a work trip, not quite grasping the extraordinary circumstances he was stepping into.

Bekali was born in China in 1976 to Kazakh and Uighur parents, moved to Kazakhstan in 2006 and received citizenship three years later. He was out of China in 2016, when authorities sharply escalated a 'People's War on Terror' to root out what the government called religious extremism and separatism in Xinjiang, a large Chinese territory bordering Pakistan and several Central Asian states, including Kazakhstan.

The Xinjiang he returned to was unrecognisable. All-encompassing, data-driven surveillance tracked residents in a region with around 12 million Muslims, including ethnic Uighurs and Kazakhs. Viewing a foreign website, taking phone calls from relatives abroad, praying regularly or growing a beard could land one in a political indoctrination camp, or prison, or both.

The new internment system was shrouded in secrecy, with no publicly available data on the numbers of camps or detainees.

The US State Department estimates those being held are 'at the very least in the tens of thousands.' A Turkey-based TV station run by Xinjiang exiles said almost 900,000 were detained, citing leaked government documents.

Adrian Zenz, a researcher at the European School of Culture and Theology, puts the number between several hundreds of thousands and just over 1 million. Government bids and recruitment ads studied by Zenz suggest that the camps have cost more than $100 million (£74 million pounds) since 2016, and construction is ongoing.

Omir Bekali talks about the psychological stress he endure in a Chinese internment camp. Chinese officials say ideological changes are needed to fight Islamic extremism

Omir Bekali demonstrates how he was strung up by his arms in Chinese detention before being sent to an internment camp during an interview in Almaty, Kazakhstan.

Bekali knew none of this when he visited his parents on March 25. He passed police checkpoints and handed over his decade-old Chinese identity card.

The next day, five armed policemen showed up at Bekali's parents' doorstep and took him away. They said there was a warrant for his arrest in Karamay, a frontier oil town where he lived a decade earlier. He couldn't call his parents or a lawyer, the police added, because his case was 'special.'

Bekali was held in a cell, incommunicado, for a week, and then was driven 500 miles (804 kilometers) to Karamay's Baijiantan District public security office.

There, they strapped him into a 'tiger chair,' a device that clamped down his wrists and ankles. They also hung him by his wrists against a barred wall, just high enough so he would feel excruciating pressure in his shoulder unless he stood on the balls of his bare feet. They interrogated him about his work with a tourist agency inviting Chinese to apply for Kazakh tourist visas, which they claimed was a way to help Chinese Muslims escape.

'I haven't committed any crimes!' Bekali yelled.

They asked for days what he knew about two dozen prominent ethnic Uighur activists and businessmen in Kazakhstan. Exhausted and aching, Bekali coughed up what he knew about a few names he recognised.

The police then sent Bekali to a 10- by 10-meter (32- by 32-foot) cell in the prison with 17 others, their feet chained to the posts of two large beds. Some wore dark blue uniforms, while others wore orange for political crimes. Bekali was given orange.

In mid-July, three months after his arrest, Bekali received a visit from Kazakh diplomats. China's mass detention of ethnic Kazakhs - and even Kazakh citizens - has begun to make waves in the Central Asian country of 18 million.

Omir Bekali looks at a computer to trace the location of the Chinese internment camp he was held during an interview in Almaty, Kazakhstan

Residents are seen with security personnel on the streets of Hotan in China's Xinjiang region.

China's Xinjiang province is far west and Kashgar is the biggest city west of China

Kazakh officials say China detained 10 Kazakh citizens and hundreds of ethnic Kazakh Chinese in Xinjiang over the past year, though they were released in late April following a visit by a Kazakh deputy foreign minister.

Four months after the visit, Bekali was taken out of his cell and handed a release paper.

But he was not yet free.

Bekali was driven from jail to a fenced compound in the northern suburbs of Karamay, where three buildings held more than 1,000 internees receiving political indoctrination, he said.

He walked in, past a central station that could see over the entire facility, and received a tracksuit. Heavily armed guards watched over the compound from a second level.

He joined a cell with 40 internees, he said, including teachers, doctors and students. Men and women were separated.

Internees would wake up together before dawn, sing the Chinese national anthem, and raise the Chinese flag at 7:30am. They gathered back inside large classrooms to learn 'red songs' like 'Without the Communist Party, there is no New China,' and study Chinese language and history.

They were told that the indigenous sheep-herding Central Asian people of Xinjiang were backward and yoked by slavery before they were 'liberated' by the Communist Party in the 1950s.

Before meals of vegetable soup and buns, the inmates would be ordered to chant: 'Thank the Party! Thank the Motherland! Thank President Xi!'

Discipline was strictly enforced and punishment could be harsh. Bekali was kept in a locked room almost around the clock with eight other internees, who shared beds and a wretched toilet.

Cameras were installed in toilets and even outhouses. Baths were rare, as was washing of hands and feet, which internees were told was equated with Islamic ablution.

Bekali and other former internees say the worst parts of the indoctrination programme were forced repetition and self-criticism. Although students didn't understand much of what was taught and the material bordered on the nonsensical to them, they were made to internalise it by repetition in sessions lasting two hours or longer.

Omir Bekali, front right, prepares to pray at a mosque in Almaty, Kazakhstan

Omir Bekali, third left, washes up before prayers at a mosque in Almaty, Kazakhstan

'We will oppose extremism, we will oppose separatism, we will oppose terrorism,' they chanted again and again. Almost every day, the students received guest lecturers from the local police, judiciary and other branches of government warning about the dangers of separatism and extremism.

In 4-hour sessions, instructors lectured about the dangers of Islam and drilled internees with quizzes that they had to answer correctly or be sent to stand near a wall for hours on end.

'Do you obey Chinese law or Sharia?' instructors asked. 'Do you understand why religion is dangerous?'

One by one, internees would stand up before 60 of their classmates to present self-criticisms of their religious history, Bekali said. The detainees would also have to criticise and be criticised by their peers. Those who parroted official lines particularly well or lashed into their fellow internees viciously were awarded points and could be transferred to more comfortable surroundings in other buildings, he said.

'I was taught the Holy Quran by my father and I learned it because I didn't know better,' Bekali heard one say.

'I traveled outside China without knowing that I could be exposed to extremist thoughts abroad,' Bekali recalled another saying. 'Now I know.'

A Uighur woman told AP she was held in a center in the city of Hotan in 2016. She said she and fellow prisoners repeatedly were forced to apologise for wearing long clothes in Muslim style, praying, teaching the Quran to their children and asking imams to name their children.

Praying at a mosque on any day other than Friday was a sign of extremism; so was attending Friday prayers outside their village or having Quranic verses or graphics on their phones.

While instructors watched, those who confessed to such behavior were told to repeat over and over: 'We have done illegal things, but we now know better.'

Other detainees and a re-education camp instructor tell similar stories.

In mid-2017, a Uighur former on-air reporter for Xinjiang TV known as Eldost was recruited to teach Chinese history and culture in an indoctrination camp because he spoke excellent Mandarin. He had no choice.

Residents walk past a statue showing Mao Zedong near billboards with the words for 'Welcome 19th Congress,' 'Patriotism' and 'Democracy' near a square in Kashgar in Xinjiang

Residents watch a convoy of security personnel and armored vehicles in a show of force through central Kashgar in Xinjiang region

The re-education system, Eldost said, classified internees into three levels of security and duration of sentences.

The first group typically consisted of illiterate minority farmers who didn't commit any ostensible crimes other than not speaking Chinese. The second class was made up of people who were caught at home or on their smartphones with religious content or so-called separatist materials, such as lectures by the Uighur intellectual Ilham Tohti.

The final group was made up of those who had studied religion abroad and came back, or were seen to be affiliated with foreign elements. In the latter cases, internees were often were sentenced to prison terms of 10 to 15 years, Eldost said.

While he was teaching, Eldost once saw through the window 20 students driven into the courtyard. Two rows of guards waited for them and beat them as soon as they got out of the police van. He later heard that the internees were recent arrivals who had studied religion in the Middle East.

Violence was not regularly dispensed, but every internee AP spoke to saw at least one incident of rough treatment or beatings.

Eldost said the instruction was aimed at showing how backward traditional Uighur culture is and how repressive fundamentalist Islam is compared to a progressive Communist Party. The internees' confessions of their backwardness helped drive the point home.

'Internees are told to repeat those confessions to the point where, when they are finally freed, they believe that they owe the country a lot, that they could never repay the party,' said Eldost, who escaped from China in August after paying a bribe.

Eldost said he tried in little ways to help his internees. Tasked with teaching the Three Character Classic, a Confucian standard taught widely in elementary schools, he would make up mnemonic devices to help his students - including elderly or illiterate Uighur farmers who barely knew their own language - recite a few lines. He also advised students to stop habitually saying 'praise God' in Arabic and Uighur because other instructors punished them for it.

Every time he went to sleep in a room with 80 others, he said, the last thing he would hear was the sound of misery.

'I heard people crying every night,' he said. 'That was the saddest experience in my life.'

Residents chat near a tv screen showing Chinese President Xi Jinping in Hotan in western China's Xinjiang region. The detention programme is a hallmark of China's emboldened state security apparatus under the deeply nationalistic, hard-line rule of Mr Xi

A child reacts as security personnel march by in a show of force in Kashgar in western China's Xinjiang region. Since 2016, Chinese authorities have carried out a campaign of mass detentions and indoctrination in internment camps

Another former detainee, a Uighur from Hotan in southern Xinjiang, said his newly built center had just 90 people in two classes in 2015. There, a government instructor claimed said that Uighur women historically did not wear underwear, braided their hair to signal their sexual availability, and had dozens of sexual partners.

'It made me so angry,' the detainee said. 'These kinds of explanations of Uighur women humiliated me. I still remember this story every time I think about this, I feel like a knife cut a hole in my chest.'

Kayrat Samarkan, a Chinese Kazakh from Astana who was detained while running errands in a northern Xinjiang police station in December, was sent to an internment camp in Karamagay in northern Xinjiang with 5,700 students.

Those who didn't obey, were late to class or got into fights were put for 12 hours in a loose body-suit that was made of iron and limited their movement, he said. Those who still disobeyed would be locked in a tiger chair for 24 hours. As one form of punishment, he said, instructors would press an internee's head in a tub of ice and water.

After three months, Samarkan couldn't take the lessons anymore, so he bashed his head against a wall to try to kill himself. He merely fell unconscious.

'When I woke up, the staff threatened me, saying if I did that again they would extend my sentence to 7 years there,' he said.

After 20 days, Bekali also contemplated suicide. Several days later, because of his intransigence and refusal to speak Mandarin, Bekali was no longer permitted to go into the courtyard. Instead, he was sent to a higher level of management, where he spent 24 hours a day in a room with 8 others.

A week later, he went to his first stint in solitary confinement. He saw a local judicial official walking into the building on an inspection tour and yelled at the top of his lungs. He thought even his former detention center, with the abuse he suffered, would be better.

'Take me in the back and kill me, or send me back to prison,' he shouted. 'I can't be here anymore.'

He was again hauled off to solitary confinement. It lasted 24 hours, ending late afternoon on November 24.

A policeman holding shield and baton guards a security post leading into a center locals say is used for political indoctrination in Korla in western China's Xinjiang region

Uighur security personnel patrol near the Id Kah Mosque in Kashgar in Xinjiang

That's when Bekali was released, as suddenly as he was detained eight months earlier.

A Baijiantan policemen who had always gone easy on Bekali during interrogation appeared and checked him out of the facility.

'You were too headstrong, but what the department did was unjust,' he told Bekali as he drove him to his sister's home in Karamay.

Bekali was free.

The next morning, a Saturday, the police opened their immigration office for Bekali to pick up a unique, 14-day Chinese visa. His original had long expired. Bekali left China on December 4.

Seeking compensation from the Chinese government is out of the question. But Bekali keeps a plastic folder at home of evidence that might prove useful someday: his passport with stamps and visas, travel records and a handwritten Chinese police document dated and imprinted with red-ink seals.

The document is the closest thing he has to an official acknowledgement that he suffered for eight months. It says he was held on suspicion of endangering national security; the last sentence declares him released without charge.

At first, Bekali did not want the AP to publish his account for fear that his sister and mother in China would be detained and sent to re-education.

But on March 10, back in China, the police took his sister, Adila Bekali. A week later, on March 19, they took his mother, Amina Sadik. And on April 24, his father, Ebrayem.

Bekali changed his mind and said he wanted to tell his story, no matter the consequences.

'Things have already come this far,' he said. 'I have nothing left to lose.'