For decades, Uyghur imam Memtimin Emer was a bedrock of his farming community in China's far west. On Fridays, he preached Islam as a religion of peace. On Sundays, he treated the sick with free herbal medicine. In the winter, he bought coal for the poor.

Key points: The leaked database has information on 311 individuals and more than 2,000 of their relatives, neighbours and friends

The leaked database has information on 311 individuals and more than 2,000 of their relatives, neighbours and friends It shows the Chinese Government detained them for religious activities such as praying, attending a mosque, and growing a beard

It shows the Chinese Government detained them for religious activities such as praying, attending a mosque, and growing a beard Information leaked last year showed the "training" camps were centres for forced ideological and behavioural re-education

But as a Chinese Government mass detention campaign engulfed his native Xinjiang region three years ago, the elderly imam was swept up and locked away, along with all three of his sons living in China.

Now, a newly revealed database has exposed in extraordinary detail the main reasons for the detentions of Mr Emer, his three sons, and hundreds of others in Karakax County: their religion and their family ties.

The leaked database contains details of 311 individuals and lists information on more than 2,000 of their relatives, neighbours and friends.

It shows the Chinese Government focuses on religion as a reason for detention — not just political extremism, as authorities say, but ordinary activities such as praying, attending a mosque, or even growing a long beard.

Each entry includes a detainee's name, address, national identity number, detention date and location, along with a detailed dossier on their family, religious and neighbourhood background, the reason for their detention, and a decision on whether or not to release them.

Issued within the past year, the documents do not indicate which government department compiled them or for whom.

Uyghur security personnel patrol near the Id Kah Mosque in Kashgar in western China's Xinjiang region. ( AP: Han Guan )

Taken as a whole, the information offers the fullest and most personal view yet into how Chinese officials decide who to put into and let out of detention camps, as part of a massive crackdown that has locked away more than a million ethnic minorities, most of them Muslims.

It also shows people with detained relatives are far more likely to end up in a camp themselves, uprooting and criminalising entire families like Mr Emer's in the process.

Similarly, family background and attitude are bigger factors than detainee behaviour in whether they individuals are released, the documents show.

"It's very clear that religious practice is being targeted," Darren Byler, a University of Colorado researcher studying the use of surveillance technology in Xinjiang, said.

"They want to fragment society, to pull the families apart and make them much more vulnerable to retraining and re-education."

The Xinjiang regional Government did not respond to faxes requesting comment.

When asked whether Xinjiang was targeting religious people and their families, Foreign Ministry spokesman Geng Shuang said "this kind of nonsense is not worth commenting on".

Beijing has previously said the detention centres are for voluntary job training, and that it does not discriminate based on religion.

'It underscores the witch-hunt mindset of the Government'

China has struggled for decades to control Xinjiang, where the native Uyghurs have long resented Beijing's heavy-handed rule.

Following the 9/11 attacks in the United States, officials began using the spectre of terrorism to justify harsher religious restrictions, arguing young Uyghurs were susceptible to Islamic extremism.

After militants set off bombs at a train station in Xinjiang's capital in 2014, Chinese President Xi Jinping launched a so-called People's War on Terror, transforming Xinjiang into a digital police state.

The leak of the database from sources in the Uyghur exile community followed the November release of a classified blueprint on how the mass detention system really worked.

The blueprint, obtained by the International Consortium of Investigative Journalists, showed the centres were forced ideological and behavioural re-education camps run in secret.

Another set of documents leaked to the New York Times revealed the historical lead-up to the mass detention.

The detainees listed come from Karakax County, a traditional settlement of about 650,000 on the edge of Xinjiang's Taklamakan desert where more than 97 per cent of residents are Uyghur.

The list was corroborated through interviews with former Karakax residents, Chinese identity verification tools, and other lists and documents.

Detainees and their families were tracked and classified by rigid, well-defined categories.

Households were designated as "trustworthy" or "not trustworthy", their attitudes were graded as "ordinary" or "good", and families had "light" or "heavy" religious atmospheres.

The database also kept count of how many relatives of each detainee were locked in prison or sent to a "training centre".

Officials used these categories and information to determine how suspicious a person was — even if they had not committed any crimes.

"It underscores the witch-hunt mindset of the Government and how the Government criminalises everything," Adrian Zenz, an expert on the detention centres, said.

Reasons listed for internment included "minor religious infection", "disturbs other persons by visiting them without reasons", "relatives abroad", "thinking is hard to grasp" and "untrustworthy person born in a certain decade".

The last seems to refer to younger men — about 31 per cent of people considered "untrustworthy" were in the age bracket of 25 to 29 years, according to an analysis of the data by Mr Zenz.

'He never bowed down to them'

When former student Abdullah Muhammad spotted Mr Emer's name on the list of the detained, he was distraught.

"He didn't deserve this," Mr Muhammad said. "Everyone liked and respected him. He was the kind of person who couldn't stay silent against injustice."

Even in Karakax county, famed for its intellectuals and scholars, Mr Emer was one of the most renowned teachers in the region.

Mr Muhammad studied the Koran under Mr Emer for six years as a child, following him from house to house in an effort to dodge the authorities.

He said Mr Emer was so respected the police would phone him with warnings ahead of time before raiding classes at his modest, single-storey home of brick and mud.

Though Mr Emer gave Party-approved sermons, he refused to preach Communist propaganda, Mr Muhammad said, eventually running into trouble with the authorities.

He was stripped of his position as an imam and barred from teaching in 1997, amid unrest roiling the region.

When Mr Muhammad left China for Saudi Arabia and Turkey in 2009, Mr Emer was making his living as a doctor of traditional medicine.

Mr Emer was growing old and, under heavy surveillance, he had stopped attending religious gatherings.

The database is part of a massive crackdown in China that has locked away more than a million ethnic minorities, most of them Muslim. ( AP )

That did not stop authorities from detaining the imam, aged is in his 80s, and sentencing him on various charges to up to 12 years in prison over 2017 and 2018.

The database cites four charges in various entries: "stirring up terrorism", acting as an unauthorised "wild" imam, following the strict Saudi Wahhabi sect and conducting illegal religious teachings.

Mr Muhammad called the charges false. Mr Emer had stopped his preaching, practised a moderate Central Asian sect of Islam rather than Wahhabism and never dreamed of hurting others, let alone stirring up "terrorism", Mr Muhammad said.

"He used to always preach against violence," Mr Muhammad said. "Anyone who knew him can testify that he wasn't a religious extremist."

None of Mr Emer's three sons had been convicted of a crime. But the database showed that over the course of 2017, all were thrown into the detention camps for having too many children, trying to travel abroad, being "untrustworthy", being "infected with religious extremism" or going on the Hajj, the Muslim pilgrimage to the holy city of Mecca.

It also shows their relationship to Mr Emer and their religious background was enough to convince officials they were too dangerous to let out from the detention camps.

"His father taught him how to pray," notes one entry for his eldest, Ablikim Memtimin.

"His family's religious atmosphere is thick. We recommend he continue training," said an entry for Mr Emer's youngest son.

Even a neighbour was tainted by living near him, with Mr Emer's alleged crimes and prison sentence recorded in the neighbour's dossier.

The database indicates much of the information was collected by teams of cadres stationed at mosques, sent to visit homes and posted in communities.

This information was then compiled in a dossier called the "three circles", encompassing the individuals' relatives, community, and religious background.

It was not just the religious who were detained. The database shows Karakax officials also explicitly targeted people for activities that included going abroad, getting a passport or installing foreign software

Pharmacist Tohti Himit was detained in a camp for having gone multiple times to one of 26 "key" countries, mostly Muslim, according to the database.

Mr Emer is now under house arrest due to health issues, his former student, Mr Muhammad, has heard. It is unclear where Mr Emer's sons are.

It was the imam's courage and stubbornness that did him in, Muhammad said. Though deprived of his mosque and his right to teach, Mr Emer quietly defied the authorities for two decades by staying true to his faith.

"Unlike some other scholars, he never cared about money or anything else the Communist Party could give him," Mr Muhammad said.

"He never bowed down to them — and that's why they wanted to eliminate him."

AP/ABC