Marathas did fought him but only once I believe, he invaded nine times.
Ahmad Shah Durrani
First of Nine Invasions of India
Durrani's EmpireHe invaded India nine times between 1747 and 1769. He set out from Peshawar on his first Indian expedition in December 1747. By January 1748, Lahore and Sirhind had been captured. Eventually Mughal forces were sent from Delhi to resist his advance. Lacking artillery and vastly outnumbered, he was defeated at Manupur in March 1748 by Mu'in-ul-Mulk, the son of the Wazir Qamar-ud-Din who had been killed in a preliminary skirmish. Ahmad Shah retreated to Afghanistan and Mu'in-ul-Mulk was appointed governor of the Punjab. Before Mu'in-ul-Mulk could consolidate his position, Ahmad Shah, in December 1749, again crossed the Indus. Receiving no reinforcements from Delhi, Mu'in-ul-Mulk was forced to make terms with him. In accordance with instructions from Delhi, Ahmad Shah was promised the revenues of the Chahar Mahal (Gujrat, Aurangabad, Sialkot and Pasrur) which had been granted by the Mughal emperor Muhammad Shah to Nadir Shah in 1739. The nonpayment of the revenues of the Chahar Mahal was the reason for his third Indian expedition of 1751-52. Lahore was besieged for four months and the surrounding country devastated. Mu'in-ul-Mulk was defeated in March 1752, but was reinstated by Ahmad Shah to whom the emperor formally ceded the two subahs of Lahore and Multan .
During this expedition Kashmir was annexed to the Durrani empire. By April 1752 Ahmad Shah was back in Afghanistan. Mu'in-ul-Mulk found the Punjab a troublesome charge and his death in November 1753 only served to intensify the anarchy. All power was for a time in the hands of his widow, Mughlani Begam, whose profligacy signalled many a rebellion. The Mughal Wazir Imad ul-Mulk took advantage of this anarchy to recover the Punjab for the empire and entrusted its administration to Adina Beg. Ahmad Shah immediately set out to recover his lost province. He reached Lahore towards the end of December 1756, and, after an unopposed march, entered Delhi on 28 January 1757. The city was plundered and the defenceless inhabitants massacred. A similar fate befell the inhabitants of Mathura, Vrindavan and Agra. Towards the end of March 1757, an outbreak of cholera amongst his troops forced Ahmad Shah to leave India. The territory of Sirhind was annexed to the Afghan empire. Najib ud-Daula, the Ruhila leader who had supported him, was left in charge of Delhi and his own son, Taimur, appointed viceroy of the Punjab. He had no sooner left India than the Sikhs, together with Adina Beg, rose in revolt against Taimur. Early in 1758 Adina Beg invited the Marathas to expel the Afghans from the Punjab. This was accomplished by the Marathas who actually crossed the Indus and held Peshawar for a few months. These events brought Ahmad Shah to India once again (1759-61). The Marathas rapidly evacuated the Punjab before the Afghan advance and retreated towards Delhi. They were routed with enormous losses at Panipat on 14 January 1761.
Vadda Ghallughara—the Great Killing
After Panipat the main factor to reckon with was the growing power of the Sikhs who had constantly been assailing Ahmad Shah's lines of communication. It was against them that the Afghan invader's sixth expedition (1762) was specifically directed. News had reached him in Afghanistan of the defeat, after his withdrawal from the country, of his general, Nur ud-Din Bamezai, at the hands of the Sikhs who were fast spreading themselves out over the Punjab and had declared their leader, Jassa Singh Ahluvalia, king of Lahore (1761). To rid his Indian dominions of them once for all, he set out from Qandahar. Marching with alacrity, he overtook the Sikhs as they were withdrawing into the Malva after crossing the Sutlej. The moving caravan comprised a substantial portion of the total Sikh population and contained, besides active fighters, a large body of old men, women and children who were being escorted to the safety of the interior of the country. Surprised by Ahmad Shah, the Sikhs threw a cordon round those who needed protection, and prepared for the battle. Continuing their march in this form, they fought the invaders and their Indian allies desperately. Ahmad Shah succeeded, in the end, in breaking through the ring and glutted his spite by carrying out a fullscale butchery. Near the village of Kup, near Malerkotia, nearly 25,000 Sikhs were killed in a single day's battle (5 February 1762), known in Sikh history as Vadda Ghallughara, the Great Killing. But the Sikhs were by no means crushed.
Harimandar Quickly Restored
Within four months of the Great Carnage, the Sikhs had inflicted a severe defeat on the Afghan governor of Sirhind. Four months later they were celebrating Divali in the Harimandar (God's Temple) Amritsar, which had been blown up with gunpowder by order of the Shah in April 1762, and were fighting with him again a pitched battle forcing him to withdraw from Amritsar under cover of darkness (17 October). Ahmad Shah left Lahore for Afghanistan on 12 December 1762.
Ahmad Shah planned another crusade against the Sikhs and he invited this time his Baluch ally, Amir Nasir Khan , to join him in the adventure. He started from Afghanistan in October 1764 and reaching Lahore attacked Amritsar on 1 December 1764. A small batch of thirty Sikhs, in the words of Qazi Nur Muhammad, the author of the Jangnamah, who happened to be in the imperial train accompanying the Baluch division, "grappled with the ghazis, spilt their blood and sacrificed their own lives for their Guru." Ahmad Shah came down to Sirhind without encountering anywhere the main body of the Khalsa. This time he went no farther than Sirhind. As he was marching homewards through the Jalandhar Doab, Sikh sardars, including Jassa Singh Ahluvalia, Jassa Singh Ramgarhia, Charhat Singh Sukkarchakkia, Jhanda Singh Bhangi and Jai Singh Kanhaiya, kept a close trail constantly raiding the imperial caravan. Their depredations caused great annoyance to the Shah who lost much of his baggage to the Sikhs. The floods in the River Chenab took a further toll of his men and property, and he returned to Afghanistan mauled and considerably shaken.
Last Invasions and Death of Ahmad Shah
The fear of his Indian empire falling to the Sikhs continued to obsess the Shah's mind and he led out yet another punitive campaign against them towards the close of 1766. This was his eighth invasion into India. The Sikhs had recourse to their old game of hideandseek. Vacating Lahore which they had wrested from Afghan nominees, Kabuli Mall and his nephew Amir Singh, they faced squarely the Afghan general, Jahan Khan at Amritsar, forcing him to retreat, with 6,000 of the Durrani soldiers killed. Ahmad Shah offered the governorship of Lahore to Sikh sardar, Lahina Singh Bhangi, but the latter declined the proposal. Jassa Singh Ahluvalia, with an army of 30,000 Sikhs, roamed about the neighbourhood of the Afghan camp plundering it to his heart's content. Never before had Ahmad Shah felt so helpless. The outcome of the unequal, but bitter, contest now lay clearly in favour of the Sikhs. The Shah had realized that his Indian dominions were at the mercy of the Sikhs and he bowed to the inevitable. His own soldiers were getting restive and the summer heat of the Punjab was becoming unbearable. He, at last, decided to return home, but took a different route this time to avoid molestation by the Sikhs. As soon as Ahmad Shah retired, Sikhs reoccupied their territories.
The Shah led out his last expedition in the beginning of 1769. He crossed the Indus and the Jehlum and reached as far as the right bank of the Chenab and fixed his camp at Jukalian to the northwest of Gujrat. By this time the Sikhs had established themselves more firmly in the country. Moreover, dissensions broke out among the Shah's followers and he was compelled to return to Afghanistan.
On Ahmad Shah's death in 1772 of the cancerous wound said to have been caused on his nose by a flying piece of brick when the Harimandar Sahib was destroyed with gunpowder, his empire roughly extended from the Oxus to the Indus and from Tibet to Khurasan. It embraced Kashmir, Peshawar, Multan, Sindh, Baluchistan, Khurasan, Herat, Qandahar, Kabul and Balkh.