Mahmud of Ghazni
In 1001 Mahmud of Ghazni first invaded modern day Pakistan and then parts of India. Mahmud defeated, captured, and later released the Hindu Shahi ruler Jayapala, who had moved his capital to Peshawar (modern Pakistan). Jayapala killed himself and was succeeded by his son Anandapala. In 1005 Mahmud of Ghazni invaded Bhatia (probably Bhera), and in 1006 he invaded Multan, at which time Anandapala's army attacked him. The following year Mahmud of Ghazni attacked and crushed Sukhapala, ruler of Bathinda (who had become ruler by rebelling against the Shahi kingdom). In 1013, during Mahmud's eighth expedition into eastern Afghanistan and Pakistan, the Shahi kingdom (which was then under Trilochanapala, son of Anandapala) was overthrown.