The Uyghur Khaganate (also Uyghur Empire or Uighur Khaganate, self defined as Toquz-Oghuz country; Toquz Oγuz budun, Tang-era names, with modern Hanyu Pinyin: or ) was a Turkic empire that existed for about a century between the mid 8th and 9th centuries. They were a tribal confederation under the Orkhon Uyghur (回鶻) nobility, referred to by the Chinese as the Jiu Xing ("Nine Clans"), a calque of the name Toquz Oghuz or Toquz Tughluq. In the mid 5th century, Uyghurs was a tribe under Tiele which is also under the Turkic Khaganate. In 657, the Western Turkic Khaganate was defeated by the Tang dynasty, after which the Uyghurs defected to the Tang. Prior to this the Uyghurs had already shown an inclination towards alliances with the Tang when they fought with them against the Tibetan Empire and Turks in 627. In 742, the Uyghurs, Karluks, and Basmyls rebelled against the Second Turkic Khaganate. In 744, the Basmyls captured the Turk capital of Ötüken and killed the reigning Özmiş Khagan. Later that year, a Uyghur-Karluk alliance formed against the Basmyls and defeated them. Their khagan was killed, and the Basmyls ceased to exist as a people. Hostilities between the Uyghurs and Karluks then forced the Karluks to migrate west into Zhetysu and conflict with the Türgesh, whom they defeated and conquered in 766. The Uyghur khagan's personal name was Qullığ Boyla (). He took the title Kutlug Bilge Kol Khagan (Glorious, wise, mighty khagan), claiming to be the supreme ruler of all the tribes. He built his capital at Ordu-Baliq. According to Chinese sources, the territory of the Uyghur Empire then reached "on its eastern extremity, the territory of Shiwei, on the west the Altai Mountains, on the south it controlled the Gobi Desert, so it covered the entire territory of the ancient Xiongnu". In 745, the Uyghurs killed the last khagan of the Göktürks, Báiméikèhán Gǔlǒngfú (白眉可汗 鶻隴匐), and sent his head to the Tang. Tang Huiyao, vol. 98, listed nine Toquz Oghuz surname tribes (姓部 xìngbù); another list of tribes (部落 bùluò) was recorded in the Old Book of Tang and the New Book of Tang.