Yelü Dashi
The Khitans were people of the Liao dynasty who moved west from Northern China when the Jin dynasty invaded and destroyed the Liao dynasty in 1125. Liao remnants were led by Yelü Dashi who took the Eastern Karakhanid capital of Balasaghun. In 1137, they defeated the Western Karakhanids, a vassal of the Seljuks, at Khujand, and the Karakhanid ruler Mahmud II appealed to his Seljuk overlord Ahmed Sanjar for protection.