After the disintegration of the Xianbei state, nomadic groups were led by their khagan, Tuyuhun, to the rich pasture lands around Qinghai Lake about the middle of the 3rd century AD. Murong Tuyuhun was the older brother of the Former Yan's ancestor Murong Hui and elder son of the Chanyu Murong Shegui of the Murong Xianbei who took his people from their original settlements on the Liaodong Peninsula to the region of the Yin Mountains, crossing the Yellow River between 307 and 313, and into the eastern region of modern Qinghai. The Tuyuhun Empire was established in 284 by subjugating the native peoples referred to as the Qiang, including more than 100 different and loosely coordinated tribes that did not submit to each other or any authority. After Tuyuhun died in Linxia, Gansu in 317, his sixty sons further expanded the empire by defeating the Western Qin and Xia kingdoms. The Qinghai Xianbei, Tufa Xianbei, Qifu Xianbei and Haolian Xianbei joined them. They moved their capital west of Qinghai Lake. These Xianbei groups formed the core of the Tuyuhun Empire and numbered about 3.3 million at their peak. They carried out extensive military expeditions westward, reaching as far as Hotan in Xinjiang and the borders of Kashmir and Afghanistan, and established a vast empire that encompassed Qinghai, Gansu, Ningxia, northern Sichuan, eastern Shaanxi, southern Xinjiang, and most of Tibet, stretching 1,500 kilometers from east to west and 1,000 kilometers from north to south. They unified parts of Inner Asiafor the first time in history, developed the southern route of the Silk Road, and promoted cultural exchange between the eastern and western territories, dominating the northwest for more than three and half centuries until it was destroyed by the Tibetan Empire. The Tuyuhun Empire existed as an independent kingdom outside China and was not included as part of Chinese historiography.
In the beginning of the Tang dynasty, the Tuyuhun Empire came to a gradual decline and was increasingly caught in the conflict between China and Tibet. Because the Tuyuhun controlled the crucial trade routes between east and the west, the empire became the immediate target of invasion by the Tang. The Tibetan Empire developed rapidly under the leadership of Songtsen Gampo, who united the Tibetans and expanded northward, directly threatening the Tuyuhun Empire. Soon after he took the throne of the Yarlung Kingdom in Central Tibet in 634, he defeated the Tuyuhun near Qinghai Lake and received an envoy from the Tang. The Tibetan emperor requested marriage to a Chinese princess, but was refused. In 635-6 the Tang emperor defeated the Tibetan army; after this campaign, the Chinese emperor agreed to provide a Chinese princess to Songtsen Gampo. The Tibetan emperor, who claimed that the Tuyuhun objected to his marriage with the Tang, sent 200,000 troops to attack. The Tuyuhun troops retreated to Qinghai, whereas the Tibetans went eastward to attack the Tangut people and reached into southern Gansu. The Tang government sent troops to fight. Although the Tibetans withdrew in response, the Tuyuhun Empire lost much of its territory in southern Gansu to Tibetans. The Tuyuhun Government was split between the pro-Tang and pro-Tibet factions, with the latter increasingly becoming stronger and collaborated with Tibet to bring about an invasion. The Tang sent general Xue Rengui to lead 100,000 troops to fight Tibet in Dafeichuan. They were annihilated by the ambush of 200,000 troops led by Dayan and the Tibetans. Tibet overtook the entire territory of the Tuyuhun.
Disintegration
After the fall of the kingdom, the Tuyuhun people split. Led by Murong Nuohebo on the eastern side of the Qilian Mountains they migrated eastward into central China. The rest remained and were ruled by the Tibetan Empire. Through this period, the Xianbei underwent massive diasporata over a vast territory that stretched from the northwest into central and eastern parts of China, with the greatest concentrations by Mt. Yin near Ordos Loop. In 946, a Shatuo, Liu Zhiyuan, conspired to murder the highest Xianbei leader, Bai Chengfu, who was reportedly so wealthy that “his horses had silver mangers”. With the looted wealth that included an abundance of property and thousands of fine horses, Liu established the Later Han , which lasted only four years and became the shortest dynasty in Chinese history. The incident took away the central leadership and stripped the opportunity for the Xianbei to restore the Tuyuhun Kingdom, although later they were able to establish the Western Xia, which was destroyed by the Mongols.
The Tuyuhun people were experts in horse breeding and also practised agriculture. As a realm just between the Chinese empires in the east and other steppe tribes such as the Rouran Khaganate and the Tiele people, the Tuyuhun acted as envoys and traders, while many Buddhist missionaries and travelers crossed their country. When the Chinese pilgrim monk, Songyun, visited the region in 518, he noted that the people had a written language, which was more than a hundred years before Thonmi Sambhota is said to have returned from India after developing a script for writing the Tibetan language.