China's construction of a vast, all-seeing police state in its fractious far west has triggered a government spending spree worth billions to firms providing a hi-tech network of cameras and "re-education centres".
The surveillance machine in Xinjiang region has grown exponentially in recent years, used by the ruling Communist Party to guard against what it considers Islamic extremism and separatism in the region.
Cameras point at imams leading prayers inside mosques, diners eating in restaurants and customers haggling with shopkeepers, in what activists have described as a human rights and privacy disaster.
Facial recognition, iris scanners, DNA collection and artificial intelligence are also being used by Xinjiang's government to ensure there are "no cracks, no blind spots, no gaps" for the region's more than 20 million residents to slip through.
Already one of the most policed places on earth, Xinjiang saw security spending balloon "nearly 100 percent" last year, totalling more than 58 billion yuan ($9 billion) -- twice its spending on healthcare -- according to Adrian Zenz, a China security expert at Germany's European School of Culture and Theology.
"In 2017 alone, the region spent nearly as much on domestic security as in the six years of 2007 to 2012 combined," he said.
Much of the vast increase in security spending appears to have been financed by debt, either through deals with private firms providing the equipment or borrowing by local governments.
Authorities point to the threat of terrorism to justify the extraordinary spending -- members of the mostly Muslim Uighur minority have been tied to mass stabbings, bombings, riots and clashes with the government that left hundreds dead in recent years across China.
But for Chinese companies like Shenzhen-listed Hikvision, the world's largest supplier of surveillance equipment, Xinjiang's booming security apparatus is a major windfall.
The firm won at least five security-related contracts totalling 1.85 billion yuan in Xinjiang in 2017, according to government-affiliated industry website Its114 -- including a "social prevention and control system" featuring tens of thousands of cameras.
Hikvision is among several companies competing for thousands of security-related tenders published by local governments in the region since the beginning of 2017.
The tenders invite contractors to do everything from providing police uniforms and armoured cars to building "re-education centres", where detainees are held indefinitely without due process and are subjected to "thought reform" including military-style drills and compulsory Marxism classes.
Among Hikvision's projects is a 309 million-yuan contract for rural Moyu county, where spending on public security almost quadrupled year-on-year in the first 10 months of 2017 to more than three times total revenue, government documents showed.
A tender obtained by AFP detailed a network of around 35,000 cameras that would monitor the county's schools, streets, offices and 967 mosques, where they will ensure that imams stick to a "unified" government script.
It would also use cutting-edge networking technology, big data, cloud computing, remote sensing and satellite positioning to "maintain social order".
The winning company would provide six "video monitoring systems" for the county's re-education centres.
An AFP investigation found one-fifth of adults from one village in Moyu had been sent to the centres -- believed to hold hundreds of thousands across Xinjiang -- but which China's government has claimed do not exist
"The religious atmosphere is thick and social resistance is relatively complex" in the poverty-stricken county of 530,000, the document warned.
The winning firm would be expected to finance much of the spending itself, underwriting projects in exchange for guaranteed investment returns -- a scheme known as a Public-Private Partnership (PPP).
Moyu county financed around 85 percent of its deal with Hikvision through these "social investments", according to a government website.
In the first 10 months of 2017, Moyu spent over one billion yuan on public security, government documents showed, a 380 percent increase year-on-year and more than three times the government's total revenue during the same period.
It offered Hikvision an eight percent annual return on the project, money it hoped to pay with increased traffic fines generated by new cameras.
The agreement was one of at least 14.9 billion yuan of security-related PPP projects in Xinjiang last year, according to Chinese financial consultant CHYXX -- over 12 times the 2016 figure.
The Moyu deal was far from the largest: last July, Shenzhen-listed Dahua Technology won a 4.3 billion-yuan contract from Yarkand county to build a "safe cities programme".
The credit binge has fuelled corporate profits while piling debt on local governments.
Xinjiang's government said in April it would suspend PPP projects as part of a nationwide debt crackdown, but the notice was quickly removed from its official site.
In response to questions from AFP, a Hikvision representative said the Moyu programme was "continuing", but declined to add anything further, saying the project was "secret". Dahua's project in Yarkand has been "paused".
But analysts say there is still plenty of room for the surveillance industry to benefit.
CHYXX expects 16.2 billion yuan of demand for cameras alone over the next two to three years.
An April 2017 analysis by government-run Xinjiang Development and Reform Committee predicted "the total value of security investments will be at least 40 to 50 billion yuan".
Xinjiang's government is working hand-in-glove with contractors to promote the industry.
In 2017, it began work on an industrial park focused on developing new security technology near regional capital Urumqi.
It needed 30,000 security cameras, according to a tender. Hikvision was happy to oblige.