Jayapala was the Punjabi Hindu ruler of Kabul Shahi dynasty from 964 to 1001 CE. The kingdom of Jayapala stretched from Laghman to Kashmir and Sirhind to Multan, with Peshawar being in the center. He was the son of Hutpal and the father of Anandapala. Epithets from the Bari Kot inscriptions record his full title as "Parama Bhattaraka Maharajadhiraja Sri Jayapaladeva".
Jayapala is known for his struggles in defending his kingdom against the Ghaznavids in the modern-day eastern Afghanistan and Pakistan region. Jayapala saw a danger in the consolidation of the Ghaznavids and invaded their capital city of Ghazni both in the reign of Sebuktigin and in that of his son Mahmud, which initiated the Muslim Ghaznavid and Hindu Shahi struggles. Sebuk Tigin, however, defeated him, and he was forced to pay an indemnity. Jayapala defaulted on the payment and took to the battlefield once more. Jayapala, however, lost control of the entire region between the Kabul Valley and Indus River.
Before his struggle began Jayapala had raised a large army of Punjabi Hindus. When Jayapala went to the Punjab region, his army was raised to 100,000 horsemen and an innumerable host of foot soldiers. According to Ferishta: The two armies having met on the confines of Lumghan, Subooktugeen ascended a hill to view the forces of Jayapala, which appeared in extent like the boundless ocean, and in numbers like the ants or the locusts of the wilderness. Subooktugeen called his chiefs together, he encouraged them to glory and issued commands. His soldiers, though few in number, were divided into squadrons of five hundred men each, which were directed to attack successively, one particular point of the Jayapala army line. So that it might continually have to encounter fresh troops.
However, the Jayapala army was hopeless in the battle against the western forces, particularly against the young Mahmud of Ghazni. In the year 1001, soon after Sultan Mahmud came to power and was occupied with the Qarakhanids north of the Hindu Kush, Jayapala attacked Ghazni once more and upon suffering yet another defeat by the powerful Ghaznavid forces, near present-day Peshawar. After the Battle of Peshawar, he committed suicide because his subjects thought he had brought disaster and disgrace to the Shahi dynasty.