A Uighur man and his son look as photos as women stand in front of the Id Kah mosque in Kashgar, China, on July 31, 2014. (Kevin Frayer/Getty Images)

It was the final Friday of Ramadan, an aching hour before dusk, and on the steps of Id Kah, the mosque that marks the heart of this ancient city, things were as they have always been — almost.

Uighur men poured from the mosque’s painted gate; pigeons shuffled in the square; a woman pulled a child toward the shade.

Then, amid the crowd of worshipers in white, a most unusual apparition: the Chinese flag.

It’s not clear why an elderly, bearded man carried Communist Party colors to Friday prayer, but the flag’s appearance at the most important mosque in the Xinjiang region, during Islam’s most important month, was very much on message.

Years into the high-profile “war on terror” in the country’s far northwest, China’s officially atheist ruling party wants the world to know that it respects and honors Muslims — and that the feeling is mutual.

Id Kah is the most important mosque in China’s Xinjiang Uighur Autonomous Region, home to China’s largest population of Muslims. (Emily Rauhala/The Washington Post)

In the run-up to Ramadan this year, the government published a white paper hailing “unprecedented” levels of religious freedom in the Xinjiang Uighur Autonomous Region, which is home to China’s largest population of Muslims. It described the level of tolerance as being unmatched by “any other period in history.”

Across Kashgar’s refurbished Old City, there are signs extolling the state’s respect for faith. China’s minorities “warmly welcome the Party’s religious policy,” reads one at Id Kah.

[China orders Muslim shopkeepers to sell alcohol, cigarettes to ‘weaken’ Islam]

Warm is something of a reach. In recent years, clashes between Uighurs and local authorities have claimed hundreds of lives, including that of a China-praising imam who was assassinated at the mosque during Ramadan in 2014.

The state says the violence is the product of religious extremism, and it has increased security and surveillance across the region, putting soldiers on the streets, establishing checkpoints, and policing how Uighurs conduct business, worship and dress.

Their tactics have drawn ire at home and outrage abroad — a fact that infuriates Beijing. After stories about Ramadan “fasting bans” made headlines in Indonesia and Pakistan, China invited officials from both countries to the far northwest for government-guided tours.

An Indonesian official returned from his free trip with white-paper-style praise: “The [Chinese] state guarantees freedom of religion to all religions,” he said.

Uighur men leave the Id Kah mosque after the Eid prayers on July 29, 2014. (Kevin Frayer/Getty Images)

A Pakistani observer said he saw no evidence of restrictions on teachers, students and government employees — odd, given that those are China’s plainly stated rules.

The Ramadan propaganda war says much about faith and freedom in President Xi Jinping’s China.

By the Communist Party’s count, Islam is thriving in Xinjiang. Chinese state news media note that the number of mosques in the region has increased tenfold in 30 years and that the government has paid for thousands of students to travel abroad to study the faith.

Chinese authorities insist that Xinjiang’s Muslim Uighurs — like Christians and Tibetan Buddhists — are free to worship as they wish. But what they mean, really, is that they are free to worship on the party’s terms.

In a front-page report on Ramadan in Xinjiang, the Global Times, a party-controlled newspaper, noted that Ramadan was proceeding “without government interference” because the government has “only imposed an exemption from this practice on Party members, civil servants and underage students.”

[China’s scary lesson to the world: Censoring the Internet works]

Explaining the selective fasting ban, the Global Times cited health concerns associated with fasting and the “spirit of China as a secular country.” In interviews, four residents of Kashgar said they had direct knowledge of the ban, but they insisted on speaking on the condition of anonymity because of the sensitivity of the subject.

The seemingly contradictory stance reflects Beijing’s belief that the Communist Party can and should shape religious practice to its own ends.

At a conference in April, Xi urged cadres to improve “religious work” by “helping religions adapt to socialist society.” The goal, Xi said, is to help the faithful “merge religious doctrines with Chinese culture.”

The emphasis on integration frightens many Uighurs, who see Ramadan restrictions as part of a broader effort to curb — or outright criminalize — their culture and way of life.

Part of this is demographics. In 1949, with the People’s Republic of China was founded, Han Chinese accounted for about 6 percent of Xinjiang’s population; today that figure is more than 40 percent. Many Uighurs say they feel like outsiders in their own home.

The sense of alienation has deepened since 2009 when protests in Urumqi degenerated into violent clashes that killed about 200 people, including Uighurs and Han Chinese. The government put the region on lockdown, turning off the Internet for nine months.

The crackdowns intensified with every act of violence that followed. Officials have taken steps to sideline Uighur-language education and prohibited those younger than 18 from praying at mosques.

Authorities have selectively prosecuted Uighur men for growing beards and have arrested Uighur women for wearing certain types of veils. In one town, Muslim shopkeepers reported that local officials forced them to sell alcohol and cigarettes — all in the name of stamping out extremism.

In Kashgar, the government’s anti-terrorism rhetoric is everywhere. A public bathroom in the Old City features a 22-point infographic on how not to become an extremist. Posters at family restaurants offer rewards for information on suspicious activity.

The problem, residents said, is that almost any kind of activity can be deemed suspicious — especially if you are Uighur.

Convinced that hostile foreign forces­ are instigating violence, local authorities are wary of people with links to anything, or anyone, outside China. In some cases, the government has cut Internet service to those found using virtual private networks to get around Web controls, Kashgar residents said.

Two Uighur men confirmed reports that Kashgar police are stopping people on the street to search the contents of their phones. Foreign-made apps such as Facebook and Skype bring trouble, they said, as does any “Islamic” content — although what constitutes “Islamic" is unclear.

At a trade fair in Kashgar, a Uighur in the textile business said the police have stopped him and searched his cellphone on more than one occasion. He asked not to be named, saying that talking to a foreign reporter could itself be considered subversive, even extreme.

It doesn’t matter whether it’s Ramadan, he said, because “they can pick you up for anything.”

Xu Yangjingjing contributed to this report.

Read more

[China’s fight for gay marriage is just beginning]

[Twitter’s new China head makes a spectacularly awkward debut]

[Five things China’s censors cut from a famous American scholar’s book]

Today's coverage from Post correspondents around the world