The force that uprooted the Ghaznavid was neither from east nor west but grew up midst of them at Ghor between Ghazni and Herat.
Today, Ghor is a province of Afghanistan.
In 1010 Mahmud of Ghazni had attacked a fortified castle at Ghor in the rugged hills of Ghor. A local chief Muhammad Soor was made prisoner and brought to the King. But he consumed poison and killed himself within hours. Ghor was annexed to the territories of Mahmud.
For 150 years it was in the hands of the Ghaznavids and Seljuks. In 1161 Ghiyasuddin became chief of Ghor and with his accession, the Afghan highlanders entered into a new phase of activity. He recovered Ghazni and placed his brother Muhammad Ghori on the ruined throne of Mahmud.