Jayapala attacked the Ghaznavids and invaded their capital city of Ghazni both in the reign of Sebuktigin and that of his son Mahmud, which initiated the Muslim Ghaznavid and Hindu Shahi struggles.[4] Jayapala, however, was defeated, and he was forced to pay an indemnity to Sebuktigin.[4] Maharaja Jayapala stopped paying tribute and took to the battlefield once more.[4] Maharaja Jayapala, however, lost the battle and control of the entire region between the Kabul Valley and Khyber Pass.[2]