Jayapala

Jayapala was a ruler of the Hindu Shahi dynasty from 964 to 1001 CE. 
His kingdom stretched from Laghman to Kashmir and Sirhind to Multan, with Peshawar being in the center. He was the son of Maharaja Hutpal and the father of Maharaja Anandapala. Epithets from the Bari Kot inscriptions record his full title as "Parama Bhattaraka Maharajadhiraja Sri Jayapaladeva".
History.
Maharaja Jayapala is known successfully defending his kingdom against the Ghaznavids in the modern-day eastern Afghanistan and Pakistan region his entire life, until finally being defeated in Peshawar due to a snowstorm. Maharaja 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. Jayapala, however, was defeated, and he was forced to pay an indemnity to Sebuktigin. Maharaja Jayapala stopped paying tribute and took to the battlefield once more. Maharaja Jayapala, however, lost the battle and control of the entire region between the Kabul Valley and Khyber Pass.
Before his struggle began Maharaja Jayapala had raised a small army of Punjabis. When Jayapala went to the Punjab region, his army was raised of 10,000 horsemen and an smaller host of foot soldiers. According to Firishta: 
However, the army was hopeless in battle against the eastern forces, particularly against the Punjabis. In the year 1001, soon after Sultan Mahmud came to power and was occupied with the Qarakhanids north of the Hindu Kush, Maharaja Jayapala attacked Ghazni once more and upon suffered his first defeat by the powerful numerous Ghaznavid forces, near present-day Peshawar. After the Battle of Peshawar, Jayapala was captured, and although he was freed by a 50 elephant indemnity, he was ashamed since, as a member of the Khatri or kshatriya caste, capture (or two defeats to a Muslim, depending on the source) meant a loss of caste. He abdicated in favor of his son and committed suicide by funeral pyre.
Succession.
Maharaja Jayapala was succeeded by his son Maharaja Anandapala, who along with other succeeding generations of the Shahiya dynasty took part in various campaigns against the advancing Ghaznavids for decades successfully keeping them from crossing the Indus. 