The period between 386 and 581 A.D. in Chinese history is conventionally called the Northern and Southern Dynasties, when North China—under the control of the Tuoba clan of the Xianbei tribe (a proto-Mongol people)—was politically separated from, yet culturally connected with, the Chinese dynasties established in Jiankang (Nanjing). The Northern Wei rulers were ardent supporters of Buddhism, a foreign religion utilized as a theocratic power for ideological and social control of the predominantly Chinese population. In the south, meanwhile, Confucian intellectuals engaged themselves in Neo-Daoist debates on metaphysical subjects, and learned monks studied and propagated Buddhist ideas that were in some ways compatible with Daoist philosophy.
The Buddhist rock-cut caves at the site of Yungang, constructed under the Northern Wei imperial sponsorship near Datong in present-day Shanxi Province, were decorated with sculptural images made after Indian models. The earlier archaic style began to change as a result of increasing diplomatic contacts between North and South China, particularly after a series of reform policies implemented by Emperor Xiaowen (r. 471–99). Marked by the adoption of Chinese language, costume, and political institutions, the Northern Wei reform contributed greatly to an artistic and cultural amalgamation in sixth-century China, which was also manifested in painting, calligraphy, the funerary and decorative arts, and the style of the cave-temples at Longmen in Henan Province.
The end of the Northern and Southern Dynasties also saw the beginning of a large influx of foreign immigrants, most of whom were traders or Buddhist missionaries from Central Asia. Some settled in China and held official posts; they adopted the Chinese way of life, but maintained their own social customs and practiced native religions. By the time China was united again under the Sui (581–618), the country had already experienced decades of relative political stability and social mobility, and its continuous receptiveness to outside influences prepared the way for the advent of the most glorious and prosperous epoch in its history—the Tang dynasty (618–907).