An Lushan Rebellion
In the early 8th century, Tang Emperor Xuanzong set up the post of military governor in China's border areas to prevent foreign invasion. Military governors were granted with military and financial power, giving them an opportunity to develop their own forces, separate from the central government. An Lushan (703-757), originally a low-ranking official, was later promoted as military governor of Pinglu, Fanyang and Hedong, because he was very clever and had gained the emperor's trust. In 755, An Lushan rebelled against the Tang Dynasty. He sacked Luoyang and enthroned himself as the "Emperor of Dayan." He then occupied and looted Chang'an (today's Xi'an). Emperor Xuanzong fled to Sichuan. His son Li Heng regained Chang'an with the military assistance from the Huihe, the ancestry group of the Uygur ethnic group, and finally suppressed the An Lushan rebellion in 763. However, this did not halt the decline of the Tang Dynasty.