Guiyi Prefecture
Guiyi Prefecture, also known as the Jinshan Kingdom of the Western Han and the Dunhuang Kingdom of the Western Han, was a Chinese military district that was usually de facto independent but nominally subordinate to the Tang dynasty, the successive Five Dynasties, and the Northern Song dynasty. Guiyi Prefecture was controlled by the Zhang family from the second half of the 9th century to the 10th century and then the Cao family during the 10th and 11th century. Guiyi Prefecture was usually headquartered in Shazhou, modern-day Dunhuang.
Background
Image:Tibetan empire greatest extent 780s-790s CE.png|thumb|left|The Tibetan Empire at its greatest extent around the 780s and the 790s CEImage:Dunhuang_Zhang_Yichao_army.jpg|thumb|400px|Section of a wall mural commemorating the victory of Zhang Yichao over the Tibetan Empire, Mogao Cave 156, Late Tang dynasty.
The Hexi Corridor was an important part of the Silk Road, connecting Central Asia with Northwest China. After the An Lushan Rebellion, the Hexi Corridor was occupied by the Tibetan Empire. Around the 770s or the 780s, Shazhou, otherwise known as Dunhuang, was occupied by the Tibetans.
Zhang family
After some 60 years of Tibetan rule, Tibet entered its Era of Fragmentation and was torn by civil war by 851. Tibetans in the Dunhuang region become part of a group known as wamo in Chinese historical sources.In 848, Zhang Yichao, a resident of Shazhou, led an uprising and captured Shazhou and Guazhou from the Tibetans.
By 850 Zhang had captured Ganzhou, Suzhou, and Yizhou. Zhang claimed the title of acting prefect of Shazhou and submitted a petition to Emperor Xuānzong of Tang, offering his loyalty and submission.
In 851 Zhang captured Xizhou. Envoys from Shazhou reached the Tang court and the emperor responded by naming Zhang's territory Guiyi Prefecture and made Zhang Yichao the Guiyi Jiedushi.
In 856 Zhang attacked the Tibetans and defeated them.
By 861 Guiyi Prefecture had extended its authority to Guazhou, Ganzhou, Suzhou, Yizhou, Lanzhou, Shanzhou, Hezhou, Minzhou, Liangzhou, and Kuozhou.
In 866 Zhang Yichao defeated the Tibetan general bLon Khrom brZhe and seized Luntai and Tingzhou. However they were immediately captured by the Kingdom of Qocho afterwards. Xizhou was also captured by the Uyghurs. BLon Khrom brZhe was an attack commissioner in the region. After Langdarma's death in 842, he fought constantly with another commissioner, Shang Bibi. He was captured by Shang Bibi's subordinate, Tuoba Huaiguang, in 866 and sent to the Tang court.
In 867 Zhang Yichao departed for the Tang court after his brother Yitan, who had been staying in Chang'an as a hostage, died. His nephew Zhang Huaishen succeeded him as Guiyi Jiedushi.
In 869 and 870, the Kingdom of Qocho attacked Guiyi Prefecture but was repelled each time.
In 872 Zhang Yichao died at court.
In 876 the Kingdom of Qocho seized Yizhou.
In 880, Qocho attacked Shazhou, but was repelled.
Around the years 881 and 882, Ganzhou and Liangzhou slipped from the control of Guiyi Prefecture. The Ganzhou Uyghur Kingdom would establish itself in Ganzhou by 894. In Liangzhou, the Tibetan state of Xiliangfu established itself by 906.
In 890 Zhang Huaishen was assassinated and his cousin Zhang Huaiding succeeded him.
In 892 Zhang Huaiding died and left his son in the care of Suo Xun, son-in-law of Zhang Yichao. Suo Xun declared himself Guiyi Jiedushi.
In 894 Suo Xun was killed by a local aristocrat by the name of Li Mingzhen and Zhang Yichao's daughter. Li's sons shared control of Guiyi Prefecture afterwards.
In 896 Li Mingzhen's sons were ousted and Zhang Chengfeng, a grandson of Zhang Yichao, became jiedushi.
In 904, Zhang Chengfeng attacked Qocho and seized Yizhou and Xizhou.
In 910 Zhang Chengfeng received news of the Tang dynasty's demise and declared himself Emperor Baiyi. Guiyi Prefecture was renamed the Jinshan Kingdom.
Kingdom of Jinshan
The rulers of Guiyi in Dunhuang briefly called themselves "emperors" for a short period after the final collapse of the Tang dynasty.In 910 Zhang Chengfeng established a kingdom known as the Western Han Jinshan, giving himself the title of "Son of Heaven." This was followed by an invasion by the Ganzhou Uyghurs.
In 911 the Ganzhou Uyghurs attacked again and the Jinshan Kingdom was forced to become a lesser partner in an alliance with the Ganzhou Uyghurs. The Great Chancellor and the elders of the Jinshan Kingdom made a treaty with the Ganzhou Uyghurs, recognizing their superiority. The relationship between the two was prescribed as "the Khan is the father, and the Son of Heaven is the son".
In 914 Cao Yijin usurped the throne and abolished the kingdom, reverting the name to Guiyi Prefecture.
Cao family
In 914 Cao Yijin usurped the throne and restored the name Guiyi Prefecture.In 916 Cao Yijin married a Ganzhou Uyghur princess and sent delegations to the Later Liang.
In 924 the Ganzhou Uyghur Khagan died and his successors Renmei and Diyin declared war on each other, with Diyin coming out victorious.
In 925 Cao Yijin defeated the Ganzhou Uyghurs.
In 926, Diyin died, and Aduoyu became the Khan of the Ganzhou Uyghurs. Aduoyu married a daughter of Cao Yijin.
Kingdom of Guiyi
In 931 Cao Yijin declared himself as Lord and Great King-reclaiming-the-west. The Cao rulers continued using the Chinese reign era names, and maintained cordial relations with the Chinese heartland and its socio-political system.In 934 Cao Yijin married his daughter to the king of Khotan.
In 935 Cao Yijin died and was succeeded by his son, Cao Yuande.
In 939 Cao Yuande died and was succeeded by his brother Yuanshen.
In 944 Cao Yuanshen died and his brother Yuanzhong succeeded him. Cao Yuanzhong's reign was characterized by progress in agriculture, transportation, and printing. Relationship with the Ganzhou Uyghurs remained relatively stable during this period.
In 950 the first depiction of fire lances appeared in Shazhou.
In 974 Cao Yuanzhong died and his nephew Cao Yangong succeeded him.
In 976 Cao Yangong died and his brother Yanlu succeeded him. Yanlu married a Khotanese princess.
In 1002 Cao Yanlu's nephew Cao Zongshou rebelled in Shazhou. Cao Yanlu and his brother Cao Yanrui committed suicide. Cao Zongshou became ruler of Guiyi.
In 1014 Cao Zongshou died and his son Cao Xianshun succeeded him.
In 1028 the Tanguts defeated the Ganzhou Uyghurs.
In 1030 Cao Xianshun surrendered to the Tanguts.
In 1036 the Tanguts, who later established the Western Xia, annexed the Kingdom of Guiyi.
Religion
Buddhism was prevalent in Dunhuang during the Guiyi period, and had been before as well under Tibetan rule. Under Tibetan rule, the number of Buddhist temples increased from 6 to 19 and more than 40 new caves were created. Confucian classics were also taught in Buddhist monasteries. Many of Zhang Yichao's family converted to Buddhism. He also studied Buddhism in his youth. A manuscript from Dunhuang contains a signature that reads, "written by Buddha's secular disciple Zhang Yichao." After Zhang Yichao took over, the Buddhists of Dunhuang reconnected with the Tang court and he presented the work of Cheng'en, a monk from the Hexi Corridor, to the Tang court to support the Buddhist restoration movement of emperors Xuanzong and Yizong. Texts that had been lost in Dunhuang due to warfare were reproduced using Tang copies. Despite Zhang's association with Buddhism, due to a shortage of manpower, he made many temple households independent peasants to satisfy the demands of recruitment.As the Tang dynasty collapsed and entered the Five Dynasties and Ten Kingdoms period, Buddhism in Dunghuang gravitated towards lay Buddhism and apocryphal sūtras rather than scripture-based tradition. At the beginning of the Guiyi period, the Buddhist master Faheng and his disciples Fajing and Fahai delivered lectures in Dunhuang. After 883, lectures by monks are no longer mentioned in manuscript colophons and only lay devotional practices such as building caves, erecting statues, and addresses to common people are recorded.
In addition to Buddhism, discoveries of Manichaean, Nestorian Christian, and Zoroastrian documents and other artifacts at Mogao Caves dating back to the Guiyi era reveal their coexistence in a multi-religious world.
Sogdians of Dunhuang
During the Tang and subsequent Five Dynasties and Song dynasty, large communities of Sogdians lived in China, especially in the multicultural entrepôt of Dunhuang, Gansu, a major center of Buddhist learning and home to the Buddhist Mogao Caves. While the region occasionally fell under the rule of different states, it retained its multilingual nature as evidenced by an abundance of manuscripts in Chinese and Tibetan, but also Sogdian, Khotanese, Uyghur, and Sanskrit.From the Chinese surnames listed in the Tang-era Dunhuang manuscript Pelliot chinois 3319V, the names of the Nine Zhaowu Clans, the prominent ethnic Sogdian families of China, have been deduced. Of these the most common Sogdian surname throughout China was Shi, whereas the surnames Shi, An, Mi, Kang, Cao, and He appear frequently in Dunhuang manuscripts and registers. Zhang Yichao appointed An Jingmin as vice commissioner of Guiyi, Kang Shijun as prefect of Guazhou, and Kang Tongxin as magistrate of some towns to the east. The influence of Sinicized and multilingual Sogdians during this Guiyijun period of Dunhuang is evident in a large number of manuscripts written in Chinese characters from left to right instead of vertically, mirroring the direction of how the Sogdian alphabet is read. Sogdians of Dunhuang also commonly formed and joined lay associations among their local communities, convening at Sogdian-owned taverns in scheduled meetings mentioned in their epistolary letters.