Mongol conquest of the Qara Khitai

The Mongol Empire conquered the Qara Khitai (Western Liao Empire) in the year 1218 AD. Prior to the invasion, war with the Khwarazmian Empire and the usurpation of power by the Naiman prince Kuchlug had weakened the Qara Khitai. When Kuchlug besieged Almaliq, a city belonging to the Karluks, vassals of the Mongol Empire, and killed their ruler Ozar, who was a grandson-in-law to Genghis Khan, Genghis Khan dispatched a force under command of Jebe and Barchuk to pursue Kuchlug. After his force of over 30,000 was defeated by Jebe at the Khitan capital Balasagun, Kuchlug faced rebellions over his unpopular rule, forcing him to flee to modern Afghanistan, where he was captured by hunters in 1218. The hunters turned Kuchlug over to the Mongols, who beheaded him. Upon defeating the Qara Khitai, the Mongols now had a direct border with the Khwarazmian Empire, which they would soon invade in 1219.

Background
After Genghis Khan defeated the Naimans in 1204, Naiman prince Kuchlug fled his homeland to take refuge among the Qara Khitai. The Gurkhan Yelü Zhilugu welcomed Kuchlug into his empire, and Kuchlug became an advisor and military commander, eventually marrying one of the daughters of Zhilugu. However, during a war with the bordering Khawarzmian dynasty, Kuchlug initiated a coup d'état against Zhilegu. After Kuchlug took power, he allowed Zhilegu to rule the Qara Khitai in name only. When the Gurkhan died in 1213, Kuchlug took direct control of the khanate. Originally a Nestorian, once among the Khitai Kuchlug converted to Buddhism and began persecuting the Muslim majority, forcing them to convert to either Buddhism or Christianity, a move which alienated Kuchlug from most of the population.

The invasion was precipitated when Kuchlug besieged the Karluk city of Almaliq, which was a vassal of the Mongol Empire and whose ruler, Ozar, was married to a daughter of Jochi. Ozar was killed, and Kuchlug advanced on the city, which requested aid from Genghis Khan.

Invasion
In 1218, after requesting Muhammad II of Khwarazm not to aid Kuchlug, Genghis Khan dispatched general Jebe with two tumens (20,000 soldiers), along with the Uyghur Barchuk (who was Genghis Khan's son-in-law) and possibly also Arslan Khan, ruler of the Karluk city Qayaliq and another son-in-law of Genghis Khan, to deal with the Qara Khitai threat, while sending Subutai with another two tumens on a simultaneous campaign against the Merkits. The two armies traveled alongside each other through the Altai and Tarbagatai Mountains until arriving at Almaliq. At that point, Subutai turned southwest, destroying the Merkits and protecting Jebe's flank against any sudden attacks from Khwarazm. Jebe relieved Almaliq, then moved south of Lake Balkash into the lands of the Qara Khitai, where he besieged the capital of Balasagun. There, Jebe defeated an army of 30,000 troops and Kuchlug fled to Kashgar. Taking advantage of the unrest fomenting under Kuchlug's rule, Jebe gained support from the Muslim populace by announcing that Kuchlug's policy of religious persecution had ended. When Jebe's army arrived at Kashgar in 1217, the populace revolted and turned on Kuchlug, forcing him to flee for his life. Jebe pursued Kuchlug across the Pamir Mountains into Badakhshan in modern Afghanistan. According to Ata-Malik Juvayni, a group of hunters caught Kuchlug and handed him over to the Mongols, who promptly beheaded him.

Aftermath
With the death of Kuchlug, the Mongol Empire secured control over the Qara Khitai. Another segment of the Qara Khitai, from a dynasty founded by Buraq Hajib, survived in Kirman as vassals of the Mongols, but ceased to exist as an entity during the reign of the Mongol Ilkhanid ruler Öljaitü. The Mongols now had a firm outpost in Central Asia directly bordering the Khwarazm Empire. Relations with the Khwarazms would quickly break down, leading to the Mongol invasion of that territory.