A relatively unknown episode of the Panipat war (1758-1761) containing the account of Khushal Khan Khattak Shaheed (the one who got martyred) and the Gakhar vassals of Durrani empire when Punjab briefly became part of Maratha empire.
In March 1758 Marathas, assisted by local Punjabis (Adina Beg and Sikhs) invaded Sirhind city of the Durrani empire. According to Tarikh-i-Alamgir Sani (a contemporary source), the Maratha army and their local Punjabi allies numbered more than 2 lakhs (200,000) and they easily captured Sirhind city.
Punjab’s governor Prince Timur Khan Durrani (who was then a young boy) and his regent Sardar Jahan Khan Popalzai realized that they would not be able to tackle huge Maratha army with their smaller force. Therefore, they abandoned Lahore and fled towards Peshawar. Maratha army and their local allies chased Afghans out of Punjab and established their rule up to the river Indus. But they only nominally ruled the Sind-Sagar doab (the region located between Jehlum River and Indus River) and Pothohar (the northern part of Sind-Sagar doab) became the contesting ground between the two powers.
The Pothohar region of Punjab was ruled by Sultan Muqqarab Khan, the chief of Gakkhars (a Punjabi Muslim tribe). He had severed connections with Mughal empire in circa 1719 and ruled a vast territory as independent ruler till 1739 when he submitted to Nadir Shah Afshar and accompanied the latter to India . He also acknowledged the suzerainty of Ahmad Shah Durrani when the latter annexed Punjab. In a letter dated to 18th June 1758, Raghunath Rao (a Maratha leader; brother of the Peshwa) writes that Muqqarab Khan Gakhar, Zabardast Khan Tanoli and other sardars of the region intended to rebel against Ahmad Shah Abdali and had written letters to him, assuring him that they were ready to enroll under Marathas . It appears that Gakkhars and others were only testing the water. Because about the end of September 1758, Gakhars were reported to be attacking Maratha-ruled territory in concert with Afghans. Tarikh-i-Alamgir Sani reports that Afghans and Gakhars crossed River Jehlum, defeated Khwaja Mirza Khan (governor of Punjab on behalf of Marathas) and his Sikh allies, and captured Gujarat . They were led by Nurrudin Bamezai, a general of Ahmad Shah Durrani. Marathas dispatched an army to deal with Afghans and their Gakkhar allies. On hearing the news of the advance of Maratha army from Lahore, Nurrudin Bamezai left Gujarat and retired to the east of River Jehlum .
Khushal Khan Khattak II
In April 1759 Maratha Generals Tukoji Holkar and Narsoji Pandit crossed river Jehlum and entered Pothohar. On Ahmad Shah Durrani’s order, Khushal Khan Khattak II (the ruler of Teri) confronted invading Maratha force with his Khattak lashkar. At the site of Hasan Abdal (in Attock district), a fierce clash took place between Pashtuns and Marathas in which Khushal Khan Khattak got martyred and his army was defeated.
Muhammad Hayat Khan, the author of Hayat-i-Afghani (published in 1867), writes:
“When Marath army advanced towards Attock to fight Ahmad Shah, Khushal Khan, the ruler of Teri, confronted Marathas on behalf of Ahmad Shah Abdali and fell fighting against them at Hasan Abdal.” 
There are many unknown graves of martyrs (who are referred to as ‘Shaheeda Baba’) in Hasan Abdal, they are most probably the graves of the martyrs of the above-mentioned battle. 
The above-mentioned Khushal Khan Khattak Shaheed was direct descendant of Khushal Khan Khattak of Aurangzeb Alamgir’s times, a renowned Pashto poet. Tarikh-i-Khurshid Jahan gives his lineage as follow:
‘Khushal Khan Khattak Shaheed son of Asad Khan son of Afzal Khan son of Ashraf Khan son of Khushal Khan Khattak.’
Khushal Khan Khattak Shaheed was also a Pashto poet. Abdul Hai Habibi has shared some of the ghazals of Khushal Khan Khattak Shaheed in his book ‘Panbana Shuara’. The village of Khushalgarh in Kohat district, after which Khushalgarh bridge on Indus river is named, was founded by him.
1- ‘Fall of the Mughal empire’, by Jadunath Sarkar, Vol-2, p-72
2– Gakhar and later Khanpur (Jagir) Rulers and brief History (chiefacoins.com)
3- “Panipat: 1761” by Shejwalker, p-6.
4- ‘Fall of the Mughal empire’, by Jadunath Sarkar, Vol-2, p-77
5- ‘Account of the kingdom of Caubul’ by Mountstuart Elphinstone, p-551
6- “Hayat-i-Afghani” by Muhammad Hayat Khan, p-324
7- “Tarikh-i-Hasan Abdal” by Manzurul Haq Siddiqi, p-106
8- “Tarikh i Khurshid Jahan” by Sher Muhammad Khan Gandapur
9- “Ahmad Shah Durrani” by Ganda Singh