Yelü Zhilugu

Yelü Zhilugu was the third emperor of the Western Liao dynasty, ruling from 1177 to 1211. He was the final ruler of the Western Liao to come from the House of Yelü, as the throne would be usurped by his son-in-law Kuchlug in 1211.

Reign
He was Yelü Yilie's second son, after Xiao Wolila (萧斡里剌) killed his aunt Yelü Pusuwan in coup, Zhilugu killed his elder brother too. According to Juvaini, "he was sacrificed in order to secure new sovereign".

Involvement in Khwarazm continued under his reign. Xiao Duolubu (蕭朵魯不) assisted Sultan Shah with his seizing of Merv and Sarakhs. In turn Tekish's new son-in-law, Kipchak leader Qara Ozan invaded Talas in 1181. However, around the 1190s, after Sultan Shah's death, Tekish again submitted to Qara Khitai and began sending tributes.

He met with fugitive Kereit prince Toghrul in 1195, who probably asked for military help with no success.

War with Ghurids
In 1198, Kara Khitai and Khwarazm combined forces invaded Ghurid principalities, with Tekish invading Herat and Zhilugu capturing Guzgan. However, the Ghurids shortly managed to inflict a heavy defeat on the two empires, and then used the opportunity to conquer Marv, Sarakhs, Nasa, Abiward, Tus, and Nishapur. Baha al-Din Sam II captured Balkh and read a Friday sermon in name of Ghurid sultan Ghiyath al-Din Muhammad. Zhilugu soon sent a military detachment under a Tayangu (a military advisor ) that year unsuccessfully.

Xiao Duolubu (蕭朵魯不) allegedly asked for huge compensation from Tekish for the war with heavy casualties. Tekish therefore turned to Ghurids for monetary help, by whose money he compensated Kara Khitai.

After Tekish's death and his energetic successor Muhammad II, war with Ghurids resumed in 1200. Soon new Ghurid sultan Muhammad of Ghor was defeated and captured by combined forces of Kara Khitai led by a Tayangu of Talas, Karakhanid khan Osman khan and his cousin Tajaddin Bilge Khan in 1204. He was released by Osman after paying ransom to the Tayangu.

Ghurid army soon arrived with reinforcements on gates of Tirmidh on summer of 1204 and seized the city. But sultan's murder on 15 March 1206 ended all his hopes of invading Central Asia. As a result, Tirmidh was recaptured by Khwarazmis and handed over to Osman khan same year.

Relations with Khwarazm
Cooperation between Qara Khitai and Khwarazm did not continue after fall of Ghurids. Soon a defector from Khwarazm army - namely Tört Aba - offered his services to Zhilugu. Defeat of Muhammad, caused a small scale civil war in Khorasan. His brother Taj ad-Din Ali-Shah and his commander Közli revolted against him, lingering his efforts on stabilisation of Khwarazm.

Around 1209 Zhilugu sent his minister Mahmud Tai to collect tributes from Khwarazm, Muhammad went to Jand and asked Terken Khatun to take care of matters, which she accomplished successfully.

Later reign
After series of troubles in west, Zhilugu's relations with his subjects grown worse with Osman Khan getting furious after Zhilugu's refusal to marry his daughter to khan. Therefore, he contacted to Muhammad II in order to move together some day against Qara Khitai overlords. Although his wishes soon accepted by Gurkhan. Meanwhile, Zhilugu, trying to pacify his rebellious Muslim subjects, took Yusuf Khan's son Muhammad Bughra as hostage in 1205, before that he asked for Karluk Arslan khan's aid against rebellious king of Khotan in 1204. His minister, Tayangu Shamur advised Arslan khan to commit suicide to pass the throne to his son, because either way Zhilugu was preparing to destroy him.

After Genghis Khan's ascension in 1206, his subjects in east - Qarluqs's new khan Arslan Sartaqtai and Uyghur idiqut Baurchuk Art Teqin submitted to Genghis Khan. Soon a refugee arrived from Mongolia in Zhilugu's court - Kuchlug in 1208. He was a prince of Naimans, a son of late Tayang khan who was killed by Genghis Khan in 1205. His uncle Buyruq khan was also killed by Genghis Khan in 1208. Zhilugu believing he could be an important asset, allowed him to gather his troops from Naimans and Merkids. He even married her daughter Princess Hunhu to him. However Kuchlug's ambitious policy made Zhilugu suspicious. He summoned Osman Khan to his court but his refusal made him angry, so he marched on Samarkand with 30.000 strong army.

Around that time, the Qara Khitai were dealing with rebellions in the east, as well as engaging in a struggle against Muhammad II of the Khwarezmian Empire in the west. The Khwarezm-Shah took Bukhara in 1207, but was defeated by the Qara Khitai at Samarkand. Kuchlug, however, apparently had formed an alliance with the Khwarezm-Shah. In 1210, while Zhilugu was dealing with a revolt by people of Samarkand, Kuchlug took the chance to rebel against his father-in-law, seizing the Qara Khitai's treasury at Uzgen. Zhilugu left Samarkand to deal with Kuchlug, but Muhammad II used the opportunity to seize Samarkand, then defeated the Qara Khitai near Talas and gained control of Transoxiana. Zhilugu pulled back to his capital of Balasagun, and defeated Kuchlug who retreated eastward to his Naiman realm.

However, in 1211, while Zhilugu was out hunting, he was ambushed and captured by Kuchlug who arrived with 8000 men near Kashgar.

Life in captivity
After his capture, he was given honorific title Taishang Huang (太上皇, Emperor Emeritus). His era name "Tianxi" (天禧; "Heavenly Joy") was continued to be used until 1218, when Kuchlug died. Sometime Muhammad II him and his daughter's hand from Kuchlug, which was denied and apparently paved way for a new war between Kuchlug and Muhammad. He died in 1213. His death is considered the end for Liao dynasty. However, through his daughter Princess Hunhu, he would be a great grandfather of Qutuqtu (the son of Yelü Zhilugu's granddaughter Linqqun Khatun and Tolui.

Religious policy
He allowed Eliya III to raise a metropolitan district around Kashgar during his reign.