Thousands of Muslims have been gathering at a mosque in north-west China to protest its planned demolition in a rare public pushback.

A large crowd of Hui people, a Muslim ethnic minority, began congregating at the towering Grand Mosque in the town of Weizhou, Ningxia on Thursday, before the Friday deadline of the demolition.

Construction of the mosque was just completed last year cost one million yuan (£114,000), which was entirely paid by local Hui residents, according to sources.

#Chinese govt tore down a magnificent mosque in an impoverished county in northwestern #Ningxia Hui Autonomous Region that was built with donations from #Hui Muslims, resulting in mass protest.#Islamophobiapic.twitter.com/4IcEDDcgFL — ☝Muslim Cyber Army ☪️ (@MCAOps) August 9, 2018

A large crowd of Hui people, a Muslim ethnic minority, began congregating at the towering Grand Mosque in the town of Weizhou, norht-west China's Ningxia region on Thursday

In a widely-circulated government notice dated August 3, officials announced that the mosque would be 'forcibly demolished' as it had not been granted the necessary planning and construction permits.

Videos on social media on Thursday showed large crowds gathered outside the mosque, a palatial white structure with towering columns, nine domes and minarets in a Middle Eastern style. A Chinese national flag is seen flying over the building. The protest appeared to be peaceful.

The protest comes as faith groups that were largely tolerated in the past have seen their freedoms shrink as the government seeks to 'Sinicise' religions by making the faithful prioritise allegiance to the officially atheist ruling Communist Party.

Islamic crescents and domes have been stripped from mosques, Christian churches have been shut down and Bibles seized, and Tibetan children have been moved from Buddhist temples to schools. All religious institutes are now required to fly the national flag.

Ethnic Hui Muslim men praying at Nanguan Mosque during Friday prayers in Linxia, Gansu

Ethnic Hui Muslim men leaving Laohuasi Mosque after Friday prayers in Linxia on March 2

The residents of Weizhou were alarmed by news that the government was planning to demolish the mosque despite initially appearing to approve its construction.

The town's Communist Party secretary had even made a congratulatory speech at the site when the mosque's construction began, said Ma Zhiguo, a resident in his late 70s.

The authorities planned to take down eight out of the nine domes topping the mosque on the grounds that the structure was built larger than permitted, Ma said. But community members were standing their ground, he added.

'How could we allow them to tear down a mosque that is still in good condition?' he said, adding that the mosque conducts prayers attended by about 30,000 Muslims and was built using believers' personal funds.

'The entire construction project - from planning to construction - did not cost the government a single penny,' resident Anran told Voice of America.

'The authorities never mentioned it being illegal before or during the construction. Local officials even came to participate in the groundbreaking ceremony. Now that the building is completed, they suddenly announce it's illegal. Don't they realise this is one million yuan of people's hard-earned money?'

Chinese Hui Muslims pray during Eid al-Fitr prayers at Niujie Mosque in Beijing (file photo)

The Grand Mosque is located in the town of Weizhou in Tongxin county, Ningxia region

'People are in a lot of pain,' said Ma Sengming, a 72-year-old man who was at the protest from Thursday morning until Friday afternoon. 'Many people were crying. We can't understand why this is happening.'

Ma told the Associated Press that the group shouted 'Protect faith in China!' and 'Love the country, love the faith!'

Officials in the county and city propaganda offices said they were not aware of the situation. Other local authorities could not immediately be reached for comment.

Ma Sengming said protesters remained at the mosque through the night from Thursday to Friday and were twice visited by a local official who encouraged them to go home. Ma said the official did not make any specific promises, but tried to assure the protesters that the government would work with them on the matter.

More than a hundred police officers surrounded the mosque, but did not attempt to stop the protest, according to Ma.

It remains unclear if the original plan to begin the demolition on Friday will go ahead, or if a compromise has been reached.

The Hui number nearly 10 million, half of the country's Muslim population in China (file photo)

Public demonstrations are rare in China, where the government is often quick to quash any hint of dissent. Under President Xi Jinping, the Communist Party is cracking down on religious expression and attacking what it calls radical ideas among the country's more than 20 million Muslims.

In the far west region of Xinjiang, following sporadic violent attacks by radical Muslim separatists, hundreds of thousands of members of the Uighur and Kazakh Muslim minorities have been arbitrarily detained in indoctrination camps where they are forced to denounce Islam and profess loyalty to the party.

Compared to those ethnic groups, the Hui are culturally much closer to China's Han majority, similar in appearance and speaking a variation of the mainstream Mandarin language.

But recently, reports said authorities have shut down Hui religious schools and Arabic classes and barred children from participating in Muslim activities.

James Leibold, a scholar of Chinese ethnic policies at Melbourne's La Trobe University, said the proposed demolition of the Weizhou mosque appeared to be part of a recent 'far more assimilatory policy' toward ethnic minorities.

'The ultimate agenda is to erode minority identity and create a sense of belonging and connection to Chinese identity and Chinese culture,' Leibold said.