耶律大石
The Qara Khitai (Western Liao dynasty) host which invaded Central Asia was composed of remnants from the defunct Liao dynasty which was annihilated by the Jin dynasty in 1125. The Liao noble Yelü Dashi recruited warriors from various tribes and formed a horde that moved westward to rebuild the Liao dynasty. Yelü occupied Balasagun on the Chu River, then defeated the Western Karakhanids in Khujand in 1137. In 1141 Qara Khitai became the dominant force in the region after they dealt a devastating blow to the Seljuk Sultan Ahmad Sanjar at the Battle of Qatwan near Samarkand. Several military commanders of Karakhanid lineages such as the father of Osman of Khwarazm fled from Karakhanid lands in the wake of the Qara Khitai invasion.