Yelü Dashi

Yelü Dashi (耶律大石 Yēlǜ Dàshí or 耶律達實 Yēlǜ Dáshí), or Yeh-Lü Ta-Shih (r. 1124–1143) was the founder of the Western Liao dynasty, or the Kara-Khitan Khanate. He was also known in Muslim sources as Nūshī Taifū, Qushqin Taifū or Qushqīn, son of Baighū.

Early life
Yelü Dashi was a member of the Khitan royal family, the eighth generation descendent of Abaoji, the founder of the Liao dynasty which ruled areas of Inner Mongolia, Outer Mongolia, and Manchuria since the tenth century. He was born in perhaps 1087. He was described in Liao Shi (History of Liao) as "well-versed in Khitan and Chinese scripts, excelled in riding and archery, and had passed the highest imperial examination in the fifth year of the Tianqing era" (1115 AD). He held various offices in the Liao administration, and rose to become a military commander.

Jurchen invasion and end of the Liao Dynasty
The Jurchens, a Tungus people native to Manchuria, established the Jin dynasty in 1115 and began to dominate Manchuria. The Jurchens formed an alliance with the Song dynasty Chinese to attack the Liao, and by 1122 the Jurchens had captured large part of Liao, including its supreme capital. The Liao emperor Tianzuo fled to the Western region, and his uncle Prince Yelü Chun then formed the short-lived Northern Liao in its southern capital Nanjing (today's Beijing). The Song forces under the command of Tong Guan attacked Northern Liao from the south, but under the command of Dashi and Xiao Gan, the Khitan army was able to repel the Song attacks. However, the Jurchens continued to advanced from the north, and eventually captured the southern capital in 1123. Just before the Jurchen takeover, Dashi slipped away with 7000 of his troops to join the Emperor Tianzuo.

Dashi was later captured by the Jurchens, but escaped five months later to rejoin the emperor. However, the emperor signalled his intention to attack the Jurchens which Dashi thought was folly as the Jurchens were in a strong position. Unable to convince the emperor, in 1124, Dashi led a band of his fellow Khitans and moved to Kedun, a Liao garrison town in the north-west. Emperor Tianzuo was captured by the Jurchens in 1125 and the Liao dynasty ended.

Rise of the Kara-Khitans
According to Chinese sources, he started out with 10,000 horses, a small force assuming at least 2 horses for every man. In Kedun, Dashi took control of the Liao imperial horse herd, marshalled his forces, and recruited warrior from other tribes, and vowed to restore the Liao dynasty. He had by then 10,000 horsemen, however Jurchens had grown far too strong, and in 1130, Dashi elected to move westward and established a base there. He was joined by other tribesmen, and the Uyghur ruler of the Kingdom of Qocho pledged his allegiance.

In 1131 or 1132, Yelü Dashi was pronounced the Gürkhan (universal Khan) by his followers. He moved to strengthen his force, gradually expanding his authority over the Karluks of Qayaliq and Almaliq. He moved over Kirghiz territory and built a town on the bank of river Emil, near Chuguchak.

Defeat of the Kara-Khanids
One wing of Dashi's force had made an early attempt at capturing the Eastern Karakhanid City of Kashgar in 1128, but was repulsed by the Karakhanid ruler there, Ahmad b. Hasan. However, the Karakhanid ruler of Balasaghun, Ibrāhīm II b. Ahmad, troubled by nomad army made up of Karluks and Qanqli tribesmen, asked Dashi for help and invited his army to the capital. Dashi instead took the chance to seize the city and, according to Persian historian Ata-Malik Juvayni, "ascended a throne that had cost him nothing.". Dashi took in 16,000 Khitan former mercenaries in Balasaghun, then established his authority over Kashgar, Khotan, the Kirghiz, and the Uyghur center of Beshbalik. However, in 1134, an attempt to re-establish the Liao dynasty in China failed.

Dashi continued to move westward into Ferghana, territory of the Western Karakhanid state. In 1137, at Khujand, he defeated the Karakhanid ruler Mahmud II who retreated back to Samarkand.

Battle of Qatwan
The Karakhanids were then vassal of the Seljuks, and Mahmud appealed to the Seljuk sultan Ahmad Sanjar for help. In 1141, Dashi, interceding in a conflict between the Karakhanids and Karluks nomad, came into direct conflict with the Seljuks. Sanjar marched his troops to meet the Kara-Khitans. At the Battle of Qatwan, however, Dashi achieved a decisive victory against the Seljuk Turks. The Seljuks army suffered a great death toll, and Sanjar barely escaped with his life, but his wife and some of his best warriors were captured. The power of the Seljuks sharply declined after the battle, and the Seljuk state collapsed into internal rebellion. The Kara-Khitans became the dominant force in Central Asia, and Khwarazm and Karakhanids became vassal states of his empire. His victory at Samarkand (Battle of Qatwan) against the Muslim Great Seljuk ruler Ahmad Sanjar, and his amicable relations with Nestorian Christianity, which flourished in the Kara-Khitan Khanate, led to his association with the legend of Prester John, a Christian king in the east who was "destined" to vanquish Islam. Bishop Otto of Freising first chronicled the story in 1145.

Death and legacy
Yelü Dashi died in 1143, master of much of Central Asia. At time of his death, the Kara-Khitan Empire encompassed the regions of Transoxiana, Ferghana, Semirechye, The Tarim Basin, and Uyghuria. The dynasty Yelü established would last until its usurpation by Kuchlug followed by conquest its domain by Genghis Khan in 1218.