Mongol conquest of the Kara-Khitai

The Mongol Empire conquered the Kara-Khitan Khanate in the years 1216-1218 AD. Already weakened from their struggle with the Khwarazmian dynasty and the usurpation of power by the Naiman prince Kuchlug, the Kara-Khitai attracted attention from the Mongols when Kuchlug besieged Almaliq, a city belonging to the Karluks, vassals of the Mongol Empire. Genghis Khan dispatched a force under command of Jebe to pursue Kuchlug in 1216, who defeated a force of 30,000 at the Khitan capital Balasagun. Following his loss at Balasagun, Kuchlug faced rebellions over his unpopular rule, forcing him to flee to modern Afghanistan, where he was killed by hunters in 1218. Upon defeating the Kara 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 Kara-Khitai. Gurkhan Yelü Zhilugu welcomed Kuchlug into his empire, and Kuchlug became an advisor and military commander, eventually marrying one of the daughters of Zhilugu. The Kara-Khitai at this time were in conflict with the expanding Khwarazmian dynasty, and as Zhilegu had to contend with Khwarazm, Kuchlug manage to stage a revolt in 1210 by raiding the treasury at Uzgen. Zhilegu, who had been quelling a revolt in Samarkand, left the city to deal with Kuchlug. Muhammad II of Khwarezm used the opportunity to seize Samarkand and then defeated the Kara-Khitai near Talas and gained control of Transoxiana. Zhilegu retreated to the capital, Balasagun, and defeated Kuchlug, but Kuchlug managed to ambush the Gurkhan during a hunting expedition in 1211. While the Zhilegu was allowed to remain ruler of the Kara-Khitai at least in name, Kuchlug retained the real power. When the Gurkhan died in 1213, Kuchlug took direct control of the khanate. While Kuchlug likely only intended to usurp the throne of the Kara-Khitai, many historians consider the death of Zhilegu the end of the Kara-Khitan Empire. Originally a Nestorian, once among the Khitan Kuchlug converted to Buddhism and began persecuting the Muslim majority, alienating himself from most of the population.

Having established himself over the Kara-Khitai, Kuchlug challenged the newly birthed Mongol Empire by advancing into the land of Uyghurs and attempting to enlist support from the Merkits, Kyrgyz, and Tümeds. When he besieged the Karluk city of Almaliq, the Karluks, vassals of the Mongol Empire, requested aid from Genghis Khan.

Invasion
After requesting Muhammad II of Khwarazm not to aid Kuchlug, Genghis Khan dispatched general Jebe to deal with the Kara-Khitai threat. Jebe relieved Almaliq, then moved on to besiege the Kara-Khitai capital of Balasagun. There, Jebe defeated the army of 30,000 sent against him and Kuchlug fled to Kashgar. Jebe gained support from the Kara-Khitan populace by announcing that Kuchlug's oppressive policy of religious persecution had ended. When his army of 20,000 men 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 Kara-Khitai, Kashgar, Yarkand (in modern-day Xinjiang), and the Kankalis around Lake Balkash. Another segment of the Kara-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.