They had been identified as a distinct ethnic group since paying tribute to the Northern Wei dynasty in the mid-6th century. During the time of the Chinese Tang dynasty the Khitan people were vassals to the suzerain Tang or Turks, depending on the balance of power between the two, or the suzerain Uyghurs when they replaced the Turks as the main steppe power. Once the Uyghurs left their home in the Mongolian Plateau in 842 enough of a power vacuum was left to give the Khitan the opportunity to cast off the bonds of subordinacy. The Khitan occupied the areas vacated by the Uyghurs bringing them under their control. In the 5th century, the Khitan were under the Toba Wei influence. In the 6th century, the Khitan tribes were still a weak confederation after being heavily defeated in 553 by the Northern Qi who enslaved many Khitans and seized a large part of their livestock, leading to harsh times for the Khitans. By that time the Khitan are still described as the lower level of nomadic civilization, their 'confederation' still being an anarchist system of isolated tribes, each tending his own sheep and horses and hunting on his private territory. Some federal leaders were created after elections during a time of war after which it became a local power. When the Sui dynasty was established in 581 when the Khitan were living in a period of internal military turmoil. Their tribes were fighting each other perhaps as a result of Sui Wendi strategy to increase tensions between nomads in order to create internal divisions. In 586 some Khitans tribes submitted to the Eastern Tujue (Turks) while others submitted to the Sui. Notable Khitan raids on the Chinese Empire were record as early as the 7th century. In 605 they staged a large scale raid southward invading Sui territories (Northern modern Shanxi, Hebei). They were eventually crushed by a Sui general leading 20,000 Turkish cavalry. Under Emperor Taizong of Tang (r. 626–649) the Khitans became vassals of Tang dynasty. Despite some occasional clashes, the Khitans remained Chinese vassals until the 690s when Empress Wu took the throne of China. According to the "Loose rein policy", the Khitan area was under Tang's control by Zhao Wenhui, the Governor-general of Yingzhou. Zhao was assisted by two local Khitan chieftains: Li Jinzhong ,the governor (Dudu) of Songmo protectorate, and Duke of Yongle County, Sun Wanrong, who was the brother-in-law of Li Jinzhong.