Seljuk Suzerainty
The eleventh century saw the rise of Seljuks. They first defeated the Ghaznavids at the Battle of Dandanaqan, then entered Iran. The Karakhanids were able to withstand the Seljuks initially, and briefly took control of Seljuk towns in Khurasan. The Karakhanids, however, developed serious conflicts with the religious classes (the ulama). In 1089 during the reign of Ibrahim's grandson Ahmad b. Khidr, at the request of the ulama of Transoxiana, the Seljuks entered and took control of Samarkand, together with the domains belonging to the Western Khanate. The Western Karakhanids Khanate became a vassal of the Seljuks for half a century, and the rulers of the Western Khanate were largely whoever the Seljuks chose to place on the throne. Ahmad b. Khidr was returned to the throne by the Seljuks, but in 1095, the ulama accused Ahmad of heresy and managed to secured his execution.
The Karakhanids of Kashgar also declared their submission following a Seljuk campaign into Talas and Semirechye, but the Eastern Khanate was a Seljuk vassal for only a short time. At the beginning of 12th century they invaded Transoxiana and even occupied the Seljuk town of Termez for a time.
Read more about this topic: Kara-Khanid Khanate