One sign of how far the government tolerates the Hui is that they are even able to practice Islamic (sharia) law to a limited extent. Sharia is not recognised by the Chinese legal code. Yet at the Najiahu mosque, the ahong and the local county court share the same mediation office. Every week or so, the ahong adjudicates in family disputes usingsharia. Only if he fails do civil officials step in.

Surprisingly, the Hui have not lost their religion or identity despite centuries of assimilation. Mr Ma, the retired professor, says Hui people often form close-knit communities and pursue similar occupations; restaurants and taxis in many cities are run by Hui. But their religion is “still the most important binding factor”, he says. The Hui maintain a delicate balance. They can practise their religion undisturbed thanks to assimilation. But it is their religion that makes them distinct.

This is a fine line, and it means the Hui are vulnerable to China’s shifting religious attitudes. They have so far mostly escaped Islamophobia. But bigotry is becoming more common on social media. “The greens” (a significant colour in Islam) has become an online term of abuse. So far the government has tolerated the Hui’s culture. But in Ningxia in July, Xi Jinping, the president, told his audience to “resolutely guard against illegal infiltration”—even though there is little sign of any. His government has become more repressive towards many religious groups. The Hui could be next.

But the lessons offered by the Hui’s experience are largely positive. Islam, the Hui show, are not the threat that party leaders sometimes imply it is. They show that you can be both Chinese and Muslim. At Yinchuan airport, a returning pilgrim is waiting for his luggage. He wears a white robe with “Chinese pilgrimage to Mecca” stitched in green Arabic letters below a Chinese flag embroidered in red, the symbol of an atheist party-state. “It was the experience of a lifetime,” he says of the haj—and disappears into a sea of white hats worn by hundreds of cheering fellow Muslims who fill the arrivals hall to welcome him home.