The exchanges of embassies, trade and culture between China and Arabia was becoming increasingly frequent by the 7th century. Many Arabian merchants became integrated into central China and along the Silk Road due to business or inter-marriage. The traders and their descendants would become the first Muslims in China.
Trade on the Silk Road all but ceased during the Song dynasty due to wars, leading to to the creation of the Maritime Silk Road that departed from China's coastal cities down to the coast of southeast Asia then onto Arabia. Many mosques that were built in the Song dynasty survive to this day in Guangzhou, Quanzhou, Hangzhou and Yangzhou.
Ethnic immigration is another factor that contributed to the introduction of Islam to China. A major wave of immigration took place during the An Lushan and Shi Siming rebellions during the Tang dynasty. The Tang emperor had to recruit soldiers from Arabia in order to crush the revolt and after the war, many of the Muslim soldiers settled in China. Another mass influx occurred after Genghis Khan established his enormous empire across Asia and Europe. He encouraged a large number of people from Central and Western Asia to immigrate to China, most of whom were Muslims. This migration later formed the basis of the Hui nationality and today the Hui continue to practise Islam with their own unique traditions.
After the 10th century, ethnic minorities in China's northwest began turning to Islam. In the late 15th century, it spread to the Uyghurs living in Xinjiang and it became the dominant religion in the region by the 17th century with the majority of Chinese Muslims following the Sunni branch.