The death of the Caliph Muktadi, which occurred about the same period, induced Berkiyāruk to go to Baghdād, where he confirmed Mostadhhir as the new Caliph, and was in return hailed by him as Sultan of the empire. He enjoyed that dignity for eleven years,[297] but his reign was a perpetual war in which his nearest relatives and all the great nobles of the state were engaged. His usual residence was Baghdād. His brother Mohammad ruled over Āzerbāyjān, while Sanjar established a kingdom in Khorāsān and Transoxiana, whence he extended his conquests over the fallen princes of Ghazna, compelling them to pay him tribute. Berkiyāruk, who appears to have had an excellent disposition, and to have been wanting neither in courage nor conduct, died on a journey from Isfahān to Baghdād,[298] A.H. 498 (1104). He felt his end approaching, and before he expired made his army take the oath of fidelity to his son Melik Shāh II. The young prince was, however, unable to resist his uncle Mohammad, who seized Baghdād treacherously and took him prisoner, A.H. 498 (1104). The reign of Mohammad, which lasted thirteen years, was remarkable only for continual civil disturbances, and for the wars which his generals carried on in Syria against the European armies engaged in their crusade to recover the sacred city of Jerusalem and the Holy Land from the Mohammedans. He died at Isfahān in A.H. 511 (1117), and was nominally succeeded by his son Mahmūd, who was almost immediately reduced by his uncle Sanjar to the condition of a dependant.[299] Sanjar, who had been governor of Khorāsān and its dependencies for the past twenty years, now became Sultan, and as such enjoyed a reign of no less than forty years, A.H. 511–552 (1117–1157).

We must now turn our attention to Transoxiana and the East, where important events were passing.


CHAPTER XIX
Sultan Sanjar and the Kara-Khitāys

The country of Khwārazm[300] was one of the first conquests of the Seljūks. On becoming masters of Khorāsān, the `Irāks, Persia, and Syria, they chose men from among their Turkish slaves whom they placed in charge of the various provinces. The governor thus set over Khwārazm was named Balkategin, who was Tasht-dār, or Grand Ewer-bearer,[301] to Sultan Melik Shāh, who exercised paramount authority in that country. He had under him a Turkish slave whom he had purchased, named Nūshtegin, who by his conduct at his master’s court was in such esteem that on the death of Balkategin[302] he succeeded to the government of Khwārazm. He became even more powerful than his lord, but, though he is regarded as the first of the dynasty of Khwārazm-Shāhs, he remained loyal to the Seljūks. He bestowed great care in the education of his son Kutb ed-Dīn Mohammad, who succeeded him in A.H. 490 (1097) with the additional title of Khwārazm-Shāh, or emperor of Khwārazm. He was a great patron of letters, and made himself generally beloved in his province.

It was during his tenure of office that the Kara-Khitāys began to make their inroads westwards.

The empire of the Kara-Khitāys had been founded by the last prince of the Kitan or Liao dynasty,[303] whose name was Ye-liu Ta-shi.[304] On the destruction of that line by the Kin dynasty[305] in A.D. 1123, Ye-liu Ta-shi, with a following of some two hundred men, passed into the country lying to the north-west of Shen-si,[306] where he was joined by numbers of Turks. He now set out in a westerly direction and carried all before him. He conquered Kāshghar, Yarkand, Khotan, and Turkestān, and at the beginning of A.D. 1124 or 1125 he reached Ki-rh-man.[307] Here all his officers assembled and proclaimed him emperor, whereupon he assumed the title of Gūr-Khān, or “Universal Lord.”

Mahmūd, the Uïghūr Khān mentioned above,[308] was driven into Transoxiana, which shortly after became tributary to the Kara-Khitāys. Ye-liu Ta-shi, whose dominions reached from the Gobi to the Oxus, and from the mountains of Tibet to Siberia, now fixed his residence at Balāsāghūn.

Towards the end of Kutb ed-Dīn’s rule they advanced so far into Transoxiana that the Grand Ewer-bearer sent an army of 100,000 men to oppose them.[309] He, however, suffered a crushing defeat, and the prince of the Kara-Khitāys, after imposing tribute on his vanquished enemies, returned to Kāshghar, which now became his capital.[310]

Soon after his deliverance from these barbarians Kutb ed-Dīn died,[311] and was succeeded by his son Atsiz. For many years the latter remained at the court of Merv, fulfilling the office of Grand Ewer-bearer to Sultan Sanjar; and so great was his influence with the Seljūk prince that he made himself many enemies at court, and on this account he asked permission to proceed to Khwārazm, which was then suffering from anarchy. In spite of the warnings of his ministers, Sanjar allowed Atsiz to depart. As soon as the governor reached his province he rose in open revolt against his master, who was compelled to march against his too powerful vassal.[312] But the rebels were no match for the troops of Sanjar, who utterly defeated them.[313] The province was restored to obedience, and Sulaymān Shāh, Sanjar’s nephew, was appointed as its governor.[314] No sooner had Sanjar reached his capital than Atsiz, collecting the scattered remnants of his army, proceeded to attack Sulaymān Shāh. This latter, with whom Sultan Sanjar had left but a few troops, deeming resistance useless, fled to his uncle, and thus the whole of Khwārazm again fell into the hands of Atsiz.