Muhammad of Ghor made two brief incursions into the Ghaznavid domains earlier in the course of which he plundered Lahore and extracted some ransom from Khusrau Malik, along with capturing some of his territories before the third successive invasion in which Khusrau Malik surrendered after a short siege and was assured of safety to present himself to Muhammad of Ghor.
However, both Khusrau Malik and his son were imprisoned and sent to Ghiyath al-Din Muhammad in Firuzkuh where they both were executed in 1191, extinguishing the Ghaznavid lineage.
[7] His brother Ala al-Din Husayn as a revenge, launched a catastrophic raid in Ghazni in 1151, Baharam Shah was defeated and fled to Lahore.
Prince Muhammad (then Shahabuddin) raided several times before finally defeating the Ghuzz Turks after a prolong struggle and annexed Ghazni along with most of the eastern Afghanistan to the Ghurid domains in 1173.
[14][15] While the Ghaznavid domain was considerably truncated, though they were still controlling parts of Punjab and Pakistan down to the valley of Kabul which were of strategic importance in the pathway to Northern India.
[16][17] According to the 12th-13th century chronicler Ibn al-Athir, the Ghurids began to invade the Ghaznavid territories in Punjab after their conquest of Ghazni in 1173 but were dissuaded by Khusrau Malik.
[14] Ferishta reference to the Rai of Delhi is probably to the Chahamana king Prithviraj II who replused a Ghaznavid invasion during his reign.
[22][23][27] A slightly different account of Ibn al-Athir claimed that, Khusrau Malik after surrendering Lahore was allowed to live in Peace "(amãn)" for two months before Ghiyath al-Din Muhammad through an envoy asked for his presence in his court.
While, Khusrau Malik was reluctant to leave as the populace of Lahore advised him against it, nonetheless, fearing a possible Ghurid invasion, he along with his son went to the court of Ghiyath al-Din.