The Tang dynasty had reconquered the Tarim Basin by the 7th century AD and for the next three centuries the Tibetan Empire, the Tang dynasty, and the Turks fought over dominion of the Tarim Basin. Sogdians and Chinese engaged in extensive commercial activities with each other under Tang rule. The Sogdians were mostly Mazdaist at this time. The Turpan region was renamed Xi Prefecture () when the Tang conquered it in 640 AD, had a history of commerce and trade along the Silk Road already centuries old; it had many inns catering to merchants and other travelers, while numerous brothels are recorded in Kucha and Khotan. As a result of the Tang conquest, policies forcing minority group relocation and encouraging Han settlement led to Turpan's name in the Sogdian language becoming known as "Chinatown" or "Town of the Chinese".