Chinese authorities here want to know what you eat and when you eat it, how you style your hair, how you dress and what songs are on your iPad or smartphone.

Stung by a string of terrorist attacks by Uighurs — members of a Muslim minority who live in northwestern China’s Xinjiang region — the Communist Party has stepped up an intrusive campaign against expressions of religious identity in the group.

Throughout Kashgar, a Silk Road city of 340,000 considered the heartland of the Uighurs, restrictions are enforced by closed-circuit cameras and an army of police and neighborhood patrols.

Paramilitary forces were seen in several locations in recent days, stopping Uighur men to check their IDs and scroll through the playlists of their phones. As for women, they are targeted by the Communist Party’s version of the fashion police. Under a local initiative known as Project Beauty, guards at mobile checkpoints detain women whose clothing looks too Islamic.

China’s Constitution allows freedom of religious thought, but the Communist Party has always tried to rein in religious fervor, whether by Muslims, Christians or Buddhists. Periods of tolerance are followed by waves of repression.

Nobody disputes that China has a serious terrorism problem. Since the beginning of 2013, nearly 300 people have been killed in violence blamed on Uighur militants.

Among the attacks: a bomb-laden car that plowed down pedestrians under the nose of Mao Zedong’s portrait at Tiananmen Square, and a gang of men and women dressed ninja style that slashed random passengers at a train station in Kunming. In late July, 96 people were killed after a gang armed with knives and axes ambushed vehicles on the main road 120 miles south of Kashgar, authorities said.

The repression campaign is drawing criticism.

“You can’t say that because somebody wears a scarf or grows a long beard they are a violent extremist. It is a lazy way for government officials to say they are striking hard against terrorism,” said Yang Shu, director of the Institute for Central Asian Studies at Lanzhou University in neighboring Gansu province. “By adopting a hard line against the practice of religion, you risk escalating the conflict.”

Forbidden to fast

About 10 million Uighurs live in China. They speak a Turkic language unrelated to Chinese. Theirs is a deeply conservative society, in which couples are matched in arranged marriages. Even in the summer’s 90-degree-plus heat, Uighur women wear skirts that cover the knees and sleeves that fall below the elbows.

By all accounts, the prohibitions against Islam are applied more strictly to the Uighurs than to other Chinese Muslims, such as the ethnic Hui people, who resemble the majority Han and live throughout China.

During the Muslim holy month of Ramadan, Kashgar authorities enacted extraordinary measures to prevent people from observing the ritual fast, in which the devout abstain from eating and drinking during daylight hours. Cafeterias at some government offices were directed to keep records of who ate lunch. Restaurants were required to remain open during the day, even if there were no customers.

University students were required to eat lunch with their teachers and forced to drink from bottles of mineral water at 4 p.m.

University officials also tried to prohibit students from eating after sunset. To enforce the ban, teachers conducted surprise inspections of dormitories between 2 a.m. and 4 a.m. to make sure nobody was snacking.

Eight female students who locked their dormitory door overnight in defiance of the rules were given an administrative punishment, meaning they could stay in school but not receive diplomas.

Students said there were spot checks of their laptops, iPads and smartphones to make sure there was no religious content.

Among the other taboos for students: Females cannot cover their heads at all, not even with a kerchief. Beards and mustaches are banned for males.

The crackdown is provoking a violent backlash.

In May, people beat up a middle-school principal who was accused of helping authorities detain students wearing scarves. As many as four people were reported to have been shot to death in the ensuing melee in Kuqa County.

On July 30, the 74-year-old imam of Kashgar’s main mosque, Juma Tahir, a former deputy to the official National People’s Congress, was stabbed to death in broad daylight in the crowded square outside the mosque. The assailants were believed to be angry about Tahir’s support of religious restrictions. Two of the attackers were shot and killed; a third was arrested.

Uighurs who criticize the government also face harsh punishment, as is evident with the recent case of Ilham Tohti.

Tohti, a Uighur economist who had been considered a moderate, was detained in January and charged recently with separatism, a crime that in China can carry the death penalty.

Extra restrictions apply to civil servants, a large part of the workforce defined to include teachers, students and employees of state-owned enterprises. In some cases, the restrictions have been extended to relatives as well. A Uighur photographer living in Beijing complained recently that his mother was barred from making a pilgrimage to Mecca because his sister teaches middle school.

Signed pledges

Bans against Islamic clothing vary by municipality. In Turpan and Aksu, people have been made to sign “guarantees” that they will not wear offending clothing. Manufacturers have been fined for making black garments. In Shache, a town south of Kashgar also known as Yarkant, inspectors visit people’s homes lecturing them on head coverings. The violence that killed nearly 100 people in the last week of July, the deadliest ethnic clash in China in five years, occurred there.

Kashgar, city popular with tourists, has adopted some of the most aggressive measures as part of Project Beauty.

At one checkpoint last month, a motorcycle was flagged down and a woman in back was ordered to dismount. The woman, who looked to be in her 40s, was wearing a long black-and-white striped dress, a patterned red scarf and a white veil that covered her mouth and nose.

Within minutes, a white van pulled up at the checkpoint with a large red sign on the side reading “Strictly Attack Terrorism and Protect the Stability of Society.” The woman climbed in the van without protest and was driven off, presumably to a Project Beauty headquarters to be given a lecture on appropriate dress.

Kashgar residents said women would just be lectured, not fined, if it was their first offense, especially as they were not wearing what Uighurs call the jilibafu, a full-length black cloak.

Photos on billboards explaining the dos and don’ts at the checkpoints show that women are allowed to wear scarves, preferably in bright colors, over their heads but not over their faces.