Who were the Uighurs?
When the Turkic Gokturk Empire in Central Asia collapsed in 742 AD, the Uighurs got their independence. Their king, or Khan, Qutlugh Bilge Kol, set up his own smaller empire in what is now Mongolia and Western China, controlling the eastern end of the Silk Road. Qutlugh Bilge Kol's son, Bayanchur Khan, succeeded him in 747. Bayanchur Khan expanded trade with China, and used the money to build cities and expand the Uighur empire.
A few years later, in 755 AD, the Chinese T'ang Dynasty emperor Suzong asked the Uighurs for help fighting a rebel general, a Sogdian named An Lu-shan. When the Uighurs won, the Emperor stopped using Sogdian mercenaries and started using Uighur mercenaries instead. Bayanchur Khan married Emperor Suzong's daughter, Princess Ningo, but Bayanchur Khan died only two years later.
Bayanchur Khan's son, Tengri Bogu, became Khan after him. Tengri Bogu and his Uighur army continued to work as soldiers for China's T'ang emperors, fighting Tibetan invasions into southern China. While Tengri Bogu was fighting, he met some Manichaean Christians from Persia. Possibly these Manichaeans were refugees who had left Persia after the Islamic conquests there. The Khan liked the idea of being Manichaean, to show that he was not Chinese, so he converted to Manichaeism in 762 AD, and so did most of the other Uighurs. Later Khans adopted the old Persian alphabet, so that Uighur writers used it to write stories and poetry. Uighur writers printed their books on printing presses that had recently been invented in China.
But around 800 AD the Uighur empire began to fall apart. There were a lot of civil wars about who should be the khan. In 841, the T'ang Dynasty Chinese emperors hired a Kyrgyz army to invade the Uighur empire; the Kyrgyz killed the last Uighur khan, Oge, and that was the end of the Uighur empire. Some Uighurs fled to the west and set up smaller kingdoms. Others fled to the east, into China, where they seem to have frightened the T'ang emperor Wuzong. In 845 AD, Wuzong ordered all followers of foreign religions to be converted or killed - that is, the Uighur refugees, who were mostly Manichaeans.
After the Uighurs - the Khitan and the Kyrgyz
Later history of the Uighurs