 For most of the century between 630 and 730 , the Khitans were under the influence of the Tang dynasty . The arrangement was largely the doing of the Khitan Dahe clan . The Tang emperor bestowed the Chinese surname Li on the Dahe and appointed their leader to a governorship that Twitchett and Tietze described as " an office specifically created for the indirect management of the Khitan tribes " . Towards the turn of the century , however , Tang control of the north began to slip as it focused attention on its other borders . In 696 the Dahe leader , Li Jinzhong , launched a rebellion and led Khitan forces into Hebei . Although the rebellion was defeated , it took over fifteen years before the Tang were able to reassert control over the Khitans , and that control would never be strong or long @-@ lived . Re @-@ disintegration of Khitan @-@ Liao relations in the 730s saw the Yaolian clan replace the Dahe as the Khitan ruling clan , forcing Tang governor An Lushan to launch two invasions into Khitan territory in 751 and 755 . After being soundly defeated by the Khitans during the first invasion , An Lushan was successful in the second , but he then led a rebellion against the Tang that included Khitan troops in his army . The An Lushan Rebellion marked the beginning of the end of the Tang dynasty . 
