The Tang dynasty was founded by Li Yuan, a military commander who proclaimed himself emperor in 618 after suppressing a coup staged by the attendants-turned-assassins of the Sui emperor, Yangdi (reigned 614-618). While Gaozu (Li Yuan's reign name) was the first of the Tang emperors, it was under his son Taizong (reigned 624-649) that the Tang dynasty consolidated its power and began to achieve a domestic peace that would last for virtually unbroken for three centuries, interrupted only by the nine-year-long An Lushan rebellion (755-763).
The Sui dynasties unified China under indigenous Chinese rule for the first time since the end of the Han period, and the Tang inherited this legacy. Yet unlike the Sui emperors, Taizong was of part Turkic ancestry, born and raised on the frontier, so he was intimately familiar with the problem of nomadic raiders who were pressing on the Tang northern borders. By 630 Taizong had defeated the first eastern Türkic nomads and resettled them north of the Ordos in Inner Mongolia. Other Central Asian peoples and minor kingdoms in northwestern China submitted to the Tang court, naming Taizong and his heirs their "supreme Khan." This brought the important Hexi corridor and Gobi oases under imperial Chinese control, and Taizong enlisted garrisons of Turkic and Central Asian soldiers to protect the trade routes, facilitating a renewed flow of trade goods transported by Central Asian, Indian and Near Eastern merchants, who also brought along with them their religion and their culture.
The Tang era is considered a golden age of sorts in the annals of Chinese history, marked as a period of unprecedented military and political dominance of the Asian continent. It is also notable for its great material prosperity, high artistic and cultural achievement, and a level of interest and tolerance regarding foreign cultures and religions that made Chang-an, the Tang capital, the most cosmopolitan city in the world. Thousands of foreigner merchants and artisans lived in Chang-an and other large cities of the empire, while followers of Buddhism, Zoroastrianism, Manichaeism, Islam and Nestorianism worshipped according to their own customs in temples, mosques or churches, some of which were built with finances donated by the Tang court.
Foreign envoys were regular visitors to the Tang court, carrying gifts and tribute of Türkic, Uighur, Tocharian, Sogdian and Iranian origin. Another breed of diplomatic envoy were the Buddhist clerics who traveled to China from India, Central Asia, Korea and Japan to both study and teach at famed temples. These clerics were often greeted at court, and in the same manner, Chinese Buddhist priests journeyed to the centers of religious learning (such as Dunhuang) that had developed in the Tarim Basin, where they interacted with clerics of many faiths. Other priests, such as the famed Xuanzang, traveled all the way to India in search of scriptures from the land of Buddhism's birth.
Tang aristocratic and affluent society was strongly influenced by foreign music and arts. Central Asian musicians and dancers were highly appreciated both in the Tang court as well as on the popular level. Aromatic dishes made from expensive imported ingredients and spices were served to the wealthy, accompanied by wine made from grapes. Chinese women set their hair in the Uighur manner, while fashionable men adopted Türkic leggings, tight-fitted bodices and headgear.1 This peaceful and profitable relationship between Chinese and foreign residents of Tang's largest cities continued until friction arose between foreign traders and Chinese merchants in the late eight century. This friction slowly escalated in the form of increasing resentment and suspicion of the expatriate tradesmen living in the Chang-an and other urban centers, until laws were passed in 836 that forbade extraneous social contact between Chinese and foreigners. In 845 the Tang court's liberal policies towards religion were reversed, and all foreign religions were outlawed.2
This disintegration of good will between Chinese and non-native populations coincided with weakening of imperial Tang political dominance in Central Asia. The beginnings of this decline are commonly dated to the year 751, when Tang forces were destroyed by an army composed of allied Türkic and Arab forces at Atlach on the Talas River (west of Lake Balkash in modern Kazakhstan). A few years later in 755, a rebellious army of 150,000 frontier troops led by General An Lushan would take the city of Jojun (modern Beijing) in the northeastern region of the empire. It took the Tang military eight years to crush the rebellion, and the empire never fully recovered. Over the next century, both peasant revolts and foreign incursions increased, while more autonomous power was passed to provincial rulers as the centralized Tang state slowly collapsed. Though a Tang emperor occupied the throne until 907, by the 890s most of the empire was in the hands of independent and ambitious military leaders. By the time of the Tang collapse the empire had split into ten kingdoms, and would remain fragmented until its reunification under the Song dynasty.
-- John D. Szostak
(1) The Exoticism in Tang (618-907), Silkroad Foundation.