After the
decline of the Western Jin dynasty, the northern parts of China came under the control of the
Tuoba-ruled
Northern Wei. They made the city of Pingcheng (), now known as Datong (), their capital. Due to its promotion, Pingcheng saw an increase in construction work. The Northern Wei early adopted Buddhism as their state religion. Buddhism arrived in this location via travel on the ancient
North Silk Road, the northernmost route of about 2600 kilometres in length, which connected the ancient Chinese capital of Xi'an to the west over the Wushao Ling Pass to
Wuwei and emerging in
Kashgar before linking to ancient
Parthia. The work on this first period of carving lasted until the year 465 AD, and these caves are now known as caves 16–20. Beginning around the year 471 AD, in a second construction phase that lasted until 494 AD, the twin caves 5/6, 7/8, and 9/10 as well as the caves 11, 12, and probably 13 were constructed under the supervision and support of the imperial court. The imperial patronage ended 494 AD with the move of the Wei court to the new capital of
Luoyang. All other caves emerged under private patronage in a third construction period, lasting until 525, when the construction came to a final halt due to uprisings in the area.
Deterioration and conservation Since the end of the works, the sandstone of the grottoes has been exposed to heavy weathering. Many of the grottoes are exposed to the open air, and are therefore vulnerable to various forms of pollution and deterioration. Windblown dust and
air pollution from the industrial city of Datong, as well as dust from mines and highways near the site pose a threat to the preservation of the ancient statues. The site is also in proximity of the Gobi Desert, the storms of which can contribute to the decay of the statues. The ensuing centuries therefore saw several attempts to preserve the caves and to repair sustained damage. During the
Liao dynasty the caves saw some renewing of statues and, from 1049 to 1060, the buildup of the "10 temples of Yungang", which were meant to protect the main caves. However, they were destroyed again some 60 years later in a fire. The wooden buildings extant in front of caves 5 and 6 were constructed in 1621, during the early
Qing dynasty. Since the 1950s, cracks in the sandstone have been sealed by grouting, and forestation has been implemented in an effort to reduce the weathering due to sandstorms. During the
Cultural Revolution,
Red Guards damaged many of the carvings, and bullet marks are still visible to observers. During April and May 1991,
Caltech personnel conducted air pollutant measurement experiments in the Yungang Grottoes. It was found that nearly all of the airborne matter was mineral dust or carbon particles, allowing a focus of attention on sources of these kinds of matter. == Cave 6 ==