Five times a day, the call to prayer is broadcast from loudspeakers at one of China’s largest mosques, in a small, ethnic Hui town in the southwestern border province of Yunnan (雲南).

Rows of date palms grow in Shadian’s Harmony Square, in front of the prayer hall, while two Chinese-style archway gates, engraved with the characters for “love the country” and “love the religion”, stand on either side of it.

In the late afternoon, swarms of students emerge from a private Islamic college and head towards the mosque to perform their fourth prayer of the day.

Islamic teaching tells us to love our country
Ma Feixiang, Hui Muslim potter

Outside, a group of Hui tourists speaking with a northern accent – women in black robes and men in white caps – take turns posing for photographs with the giant mosque behind them.

While the Chinese government has cracked down on religious activities among the Muslim Uygur community in Xinjiang ( 新疆 ), citing the threat of Islamic extremism, ethnic Hui Muslims more closely integrated with Han Chinese society have been able to enjoy much greater religious freedom.

However, growing Islamophobia in China has seen both groups targeted by online attacks at a time when anti-Muslim rhetoric is on the rise across the world.

With the country’s top leaders repeatedly warning of the dangers of radical Islam, increasing levels of online hate speech are fuelling concerns that the heavy controls in Xinjiang could be extended to the Hui community in Yunnan.

In Shadian, street signs are in Chinese, English and Arabic. Hotels, shops and restaurants have dome-shaped front doors. And banners carrying verses from the Koran hang above an outdoor halal food court.

During the Cultural Revolution, the People’s Liberation Army killed more than 1,000 Hui in Shadian during a crackdown on believers.

After China’s opening up, the government paid compensation and many Hui became rich working in the area’s copper, lead and zinc mines.

Except for its bloody history and exotic appearance, Shadian, home to about 15,000 Muslims, is little different from most rapidly developing Chinese towns.

Xinjiang’s Uygurs ‘not radical Muslims’, says China’s former culture minister

Most of China’s 10 million Hui Muslims are well assimilated with the Han population, and have thus gained the trust of the officially atheist Communist Party. They speak Chinese, look indistinguishable from the Han and live in communities scattered throughout the country.

Shadian residents today speak of their religious links with the Middle East, but they also exhibit strong patriotism and identify with Han culture.

Ma Feixiang, 45, who runs a pottery workshop on Muslim Avenue, has built an exhibition garden to honour the Hui Muslims who “contributed to the rise of the Chinese nation”.

The walls of the garden are decorated with the nameplates of Zheng He, a Ming-dynasty mariner who made voyages to Africa and Arabia, Mi Fu, a Song-dynasty calligrapher, and Mu Qing, the former head of the state-run Xinhua News Agency.

“Islamic teaching tells us to love our country,” Ma said. “We are all looking forward to the rise of greater China.”

In contrast to the Hui, the Uygurs, another Muslim ethnic minority numbering about 10 million, have been treated with suspicion by the party because of their Turkic roots and their concentration in the far northwestern region of Xinjiang.

Beijing has blamed Islamic militants and separatists for violence in Xinjiang that has killed hundreds in recent years. Strict controls on religious practice have been imposed as part of a counterterrorism campaign.

Who are Uygurs? A look at the minority group from China's restive Xinjiang

Beards for men and head coverings for women, deemed “abnormal religious clothing”, have been banned.

Students and teachers were forbidden from fasting for the holy month of Ramadan last year, according to overseas media reports, and under education rules enacted last year parents or guardians should not compel children to attend religious activities.

In comparison, back in Yunnan, it is common practice for Muslim parents to have their children attend private tutoring in Islam provided by mosques.

With Chinese universities banned from teaching theology, wealthy Hui families even send their children to receive Islamic education in countries such as Saudi Arabia, Malaysia and Pakistan.

In the provincial capital of Kunming ( 昆明 ), 11-year-old Ma Xiaowu, who was playing smartphone games in the yard of a mosque, said he went to study the Koran at a local mosque every summer.

“During Ramadan, my Han classmates ask me why I don’t eat,” he said. “I will tell them it is my faith.”

After knife-wielding Uygurs killed 31 people at Kunming’s main railway station in 2014, almost all Uygurs were expelled from Yunnan.

The city also stepped up security controls, deploying armed police to guard public squares and sending officers to mosques during Friday prayers. Locals said the measures targeted Uygurs and seldom touched local Hui. A security guard at a Kunming mosque said he had been tasked with watching out for “extremists who come to cause damage”, but that nowadays his main task involved stopping people from taking pets inside.

China must get its Uygur policy right if it is to woo the Muslim world

Meanwhile, a tour guide who organises trips for Muslims to experience the “Islamic atmosphere” of Yunnan, and Shadian in particular, said authorities only intervened when the visitors were Uygurs.

“We have to hand in their ID information and itinerary,” he said. “Sometimes police officers visit them in hotels. It does not happen if the tourists are Hui or Kazakh Muslims.”

Although the authorities currently treat Hui and Uygurs in very different ways, many Han Chinese have come to view both groups as potentially threatening.

Internet users often blame regional governments for failing to rein in what they say is a dangerous religion.

In one high-profile incident, a 33-year-old Beijing man surnamed Zhang launched an anti-halal food campaign online, saying it was an attempt to stop the spread of Islamic extremism in China.

When asked about his definition of extremism, Zhang showed an image of the five types of religious attire that have been banned in a Xinjiang city, including head-coverings for women, long beards and clothing featuring the star-and-crescent pattern.

“This is what is being done to combat terrorism in Xinjiang, but inland [governments] are not paying attention,” he said.

China ‘restricts passports’ for Tibetans, Uygurs, says rights group

On the popular search engine Baidu.com, the most frequently searched phrases about Shadian include “don’t go to Shadian” and “Shadian Islamic state”, according to the Baidu Index, which tracks web search trends.

On the Quora-like website Zhihu.com, photos of women dressed in black robes and veils in Shadian sparked a wave of Islamophobic comments, with users questioning why the counterterrorism measures in Xinjiang had not been implemented in the rest of the country.

“Why does the government turn a blind eye to all this?” one comment read.

“In Xinjiang, these people would be arrested within minutes,” said another. “The Yunnan government is too lenient.”

Hui Muslims in Yunnan have become frustrated by the hostility. Government officials in Shadian even ask reporters not to write anything about the place – good or bad – citing the subsequent hateful comments that “would hurt local people”.

James Leibold, an expert on China’s ethnic politics at La Trobe University in Australia, said the fact the online attacks were not censored by China’s otherwise highly efficient internet authorities reflected a distrust of Islam within the country’s leadership, making the Hui vulnerable to future crackdowns on their religious practices.

“People are whipping up that concern on social media,” he said. “It can put pressure on policymakers at the local level to make sure they have a firm grip.”

Guangdong on top terror alert as growing number of Uygurs move to Middle East for training

Freedom of belief is enshrined in China’s constitution, but the party keeps religious activities under tight control and allows only officially recognised religious institutions to operate.

Last year senior officials, including President Xi Jinping ( 習近平 ), warned against “religious extremism” and “overseas infiltration through religious means”.

But Leibold said it took time for such initiatives to reach places like Yunnan, a province far from the political centre with a long history of multiculturalism and ethnic autonomy.

“The party-state is moving to have more uniform implementation of policies ... very likely this surveillance society that has been created in Tibet (西藏) and Xinjiang will be extended into Hui areas,” he said.

For now, life goes on as usual in Kunming, with Muslims and non-believers living peacefully together, and the provincial government hailing its victory in forging ethnic unity.

Every morning, children wearing the red scarves of the Young Pioneers – a youth organisation run by the Communist Party – walk through the yard of the Shuncheng Mosque in Kunming to a primary school next door.

At lunchtime, halal restaurants selling beef buns and Yunnan rice noodles are packed with office workers, many of them non-Muslim Han people.

Even mosques have open canteens on the first floor serving both Muslims and non-believers. Prayers are performed on the second floor.

However, the Uygurs who once sold fruits and nuts from Xinjiang are missing from the busy Muslim quarter.

Beijing policies in Xinjiang driving Chinese Muslims to join ranks of Islamic State, says US think tank

Retired truck driver Xie Huarong, 65, who was playing with his one-year-old granddaughter outside the Hui quarter, said he used to buy melons from the Uygurs.

“I never felt they were dangerous,” he said.

Ma Tao, a 30-year-old Hui Muslim who runs a halal bakery outside the Shuncheng Mosque, said he often prayed with Uygurs in the mosque before their expulsion following the 2014 train station attack.

“It was such a stupid decision to force them to leave,” he said. “The Uygurs I met were extremely nice. We share the same belief. ”

Those sentiments were shared by Imam Yang, the owner of a shop selling women’s headscarves.

“[The Uygurs] all envy the peaceful life we have here,” he said.