Mahmud's descendants, the Ghaznavids, continue to rule over a gradually diminishing empire.
The rival Turkic Shansabanis of Ghur, who inhabit the mountainous region between Ghazna and Herat, rise rapidly in power during the last half of the twelfth century.
This ascendancy is partly due to the changing balance of power that results from the westward movement of the non-Muslim Kara-Khitans into the area dominated by the Seljuq Turks, who had been the principal power in Iran and parts of Afghanistan during the previous fifty years.
The Seljuq defeat in 1141 leads to a struggle for power among the Kara-Khitai Khanate, the Khwarezm-Shahs, and the Ghurids for control of parts of Central Asia and Iran.