The Afghan–Sikh Wars spanned from 1748 to 1837 in the Indian subcontinent, and saw multiple phases of fighting between the Durrani Empire and the Sikh Empire (and its predecessors), mainly in and around Punjab region. The conflict's origins stemmed from the days of the Dal Khalsa, and continued after the Emirate of Kabul succeeded the Durrani Empire.
Background
The Sikh Confederacy had effectively achieved independence from the Mughal Empire in 1716, and expanded at its expense in the following decades, despite the Chhota Ghallughara. The Afsharid Persian emperor Nader Shah's invasion of the Mughal Empire (1738–40) dealt a heavy blow to the Mughals, but after Nader Shah's death in 1747, Ahmed Shah Abdali, the founder of the Durrani Empire declared independence from Persia. Four years later, this new Afghan state came into conflict with the Sikh alliance.
Campaigns of Ahmad Shah Abdali
On 12 January 1748, Ahmad Shah Durrani invaded and occupied Lahore, after the Mughal governor of Lahore, Shah Nawaz Khan, fled to Delhi. Establishing a governor over Lahore, Ahmad marched his army east taking more territory, but was defeated at the Battle of Manupur by Mughals in alliance with Sikhs and fled back to Kandahar. Sikh bands under Charat Singh, Jassa Singh Ahluwalia and Ala Singh continued to harass Durrani forces as they retreated. Thus, the first invasion of Shah proved a failure but it gave an opportunity to the Sikhs to organize themselves into the Dal Khalsa, an army of the Sikh Confederacy, at Amritsar in March 1748. The Sikhs retook Lahore only to lose it to the Afghans by 12 April 1752.
The Sikhs used guerilla warfare to try to oust the Afghans from Punjab. In November 1757, the Sikhs were defeated by the Afghan army at Battle of Amritsar (also known as the Battle of Gohalwar), under the command of Timur Shah Durrani, son of Ahmad Shah Durrani. After witnessing the fall of Lahore, the Durrani commander-in-chief Jahan Khan and Timur Shah fled the city, and while trying to cross the Chenab and Ravi rivers, thousands of Afghan soldiers were drowned and much of the soldiers' baggage abandoned. Sikhs took the captured Afghan prisoners to Amritsar to clean the sacred pool in Amritsar that was desecrated by the Afghans. In 1758, the Sikhs defeated the Afghan faujdar (military officer) Sa‘adat Khan Afridi, who fled from Jalandhar, followed with the defeat of Afghan army from all direction. Though the Sikhs captured and plundered Lahore, the Afghans recaptured Lahore in 1761, but just within a couple of months, in May 1761, the Sikh army defeated the Afghan army, led by Ahmad Shah's governor of the Chahar Mahal, followed with defeat and surrender of relief party sent from Kandahar. Thereafter, Sikhs captured Lahore. In September 1761, near Gujranwala, Ahmad Shah Durrani's governor of the province of Lahore, was defeated by the Sikhs, continued with the defeat and ousting of the remaining commanders of Durrani's, eventually bringing the entire territories from the Satluj to the Indus, under Sikh occupation, along with Bist Jalandhar Doab, Sarhind, Rachna and the Chaj Doabs. Ahmad Shah lost most of the Punjab to Sikhs.
In October 1762, Ahmad Shah Durrani attacked Amritsar. At Gujranwala, Jahan Khan was heavily defeated by the Sikhs, who then continued their victory by sacking the towns of Malerkotla and Morinda, followed with the defeat of the commander of Rohtas Fortress, Sarbaland Khan Saddozai, who was captured and imprisoned but later released after consenting to the Sikh sovereignty. The reports of catastrophe enraged Ahmad Shah and wrote to Nasir Khan, beglar begi of Khalat, to join him in jihad (holy war) against the Sikhs, to destroy them and to enslave their women and children, but Ahmad Shah's march to Punjab in 1764, resulted in failure of Jihad with the defeat, ambush and ousting of advance guards by the Sikhs outside of Lahore. In 1765, Ahmad Shah marched again to Punjab with Qazi Mur Muhammad but his authority was only restricted within his camp as he remained on the defensive side with Sikhs swarming around the camp, which eventually resulted in Ahmad Shah's return to Kabul without pursuing even a single battle, where the Qazi noticed with disappointment that the country from Sirhind to Derajat was divided amongst the Sikhs with their sovereignty The Sikh sovereignty was further acknowledged in Lahore by striking a coin which pierced the same inscription that fifty five years ago was used by Banda Singh Bahadur on his seal, followed with re-establishment of 13 Sikh rule.
The Sikhs would also capture Multan in 1772. The period after this would be known as the "Sikh Interlude Period", from 1772 to 1780.
Campaigns of Timur Shah
Timur Shah ascended to the throne of the Durrani Empire after his father, Ahmad Shah Durrani's death. Timur Shah consolidated his rule through multiple attempts, and also attempted an earlier campaign in 1775, however realizing the weakness of his army in view of smaller in number, Timur Shah retired to Peshawar which proceeded with rebellion by Faizullah Khan, who plotted to assassinate Timur Shah but was cunningly executed. In late 1779, Timur Shah decided to conquer Multan. Due to Sikhs having been in possession of the provinces of Lahore and Multan, these provinces served as a barrier for any attempt by Timur Shah to invade, many chiefs and nobility, dependencies of Durranis, paid no respect to the Durrani sovereignty, such as Sind which reduced the amount of tribute and hardly paid it, mostly due to its concurrent civil war between the Talpurs, and the Kalhoras; Nasir Khan Balouch, the ruler of the Khanate of Kalat under Timur Shah did not acknowledge the authority of Afghan monarch, as a result, inducing other Durrani chiefdoms to do the same, including the chief of Bahawalpur, who treated the authority of Timur Shah with no respect. Timur Shah thereupon tried to recover Multan by diplomacy and therefore sent Haji Ali Khan, as his agent, along with companions, to the Bhangi Sikh Chiefs to negotiate, with advice to behave and be polite, but instead, Haji Ali Khan threatened the Bhangi Chiefs to retire from Multan or face the royal wrath. The Bhangis tied Haji to the tree and shot him dead whereas his companions were left unharmed and sent back to report to Timur. Upon the news of death of his agent, Timur Shah detached a force of 18,000 men that included Yusafzais, Durranis, Mughals and Qizalbashes under general Zangi Khan, with orders to march by less known routes and fall upon the Sikhs unaware and Zangi Khan gave strict orders to his army to keep the movement secret. Zangi Khan halted 25 km from the Sikh camps with orders to imprison anyone who goes in the direction of the Sikh camp to make the Sikhs aware of their presence. Timur Shah positioned himself in the centre, at the head of 5,000 Yusafzai men. Little before daybreak, early morning, the Sikhs completely unaware of Afghan army's presence, were attacked, and though unorganized, the Sikhs gave tough resistance but were eventually overwhelmed. About 3000 Sikhs were killed, and 500 others drowned in river Jhelum in trying to cross it during the Sikh retreat, while 2000 escaped by successfully reaching the opposite bank of the river. Following the victory, Timur Shah Durrani captured Multan after meeting the relieving Sikh force in Shujabad where a severe battle was fought on 8 February 1780. The Sikhs lost 2,000 men in killed and wounded and proceeded to flee towards Lahore. Timur sent a large army in pursuit of them and managed to overtake them at Hujra Muqim Khan, 64 km south west of Lahore. After this successful juncture, Timur hurried from Shujabad to Multan and ordered a general massacre in the city and besieged the fort in which the Sikh army was residing. Negotiations were held and with the acceptance of conditions, Timur took over the fort on 18 February 1780, following which Timur Shah appointed Muzaffar Khan as the Nazim of Multan and Abdul Karim Khan Babar, a defected Muslim general of the Sikh army was appointed as Naib (Chief officer) of Muzaffar Khan. Multan would remain under Afghan rule until its loss in 1818 to the Sikh Empire, during the Siege of Multan.
This phase ended with the death of Timur Shah on 20 May 1793, leading his successor, Zaman Shah Durrani to ascend to the Durrani throne.
Campaigns of Zaman Shah
Zaman Shah Durrani ascended to the Durrani throne after his father, Timur Shah died on 20 May 1793. Zaman Shah lead multiple campaigns of Punjab against the Sikhs. His first campaign was in November 1796.
First campaign of Punjab
Zaman Shah's campaign of Punjab in 1796 against the Sikhs, led to capture of Lahore in January 1797, without any opposition as the Sikh chiefs retired to Amritsar to protect the holy city. Zaman Shah progressed towards Amritsar on 13 January 1797, where he was defeated by the Sikhs, 10 km away from the city. As intelligence from Kabul had warned of a possible Persian invasion of main Afghanistan, Zaman Shah was forced to abandon his first Punjab campaign and return home to mobilize an army to combat this threat, headed by his own brother, Mahmud Shah Durrani. The Sikhs recaptured Lahore as he left. After retreat, he left his deputy general, Ahmad Khan Shahanchi-bashi in charge, along with Afghan soldiers but he too was defeated and killed by the Sikhs.
Second campaign of Punjab
Having dealt with Mahmud Shah Durrani for the time being, Zaman Shah returned to Punjab and resumed his campaign once again, occupying Lahore in autumn of 1798, without opposition, as it was strategy of Ranjit Singh to drive them into Lahore and then lay siege to the city. Zaman Shah intended to march on Delhi but the Sikhs laid waste around 150 km of his camp to stop supplies and engaged in skirmishes. Facing determined foe who could cut off his communication with Kabul, Shah Zaman exercised discretion and returned to Afghanistan with his troops on 4 January 1799. Bhangi Sikh Misl recaptured Lahore. Zaman Shah then appointed 19 yr old Ranjit Singh as governor of Lahore to try to divide the Sikhs and returned to Peshawar where Sikhs all along harried the Afghans to river Jhelum. While crossing the river, Zaman Shah lost most men, supplies and heavy artillery due to upsurge. Eventually, Shah Zaman and his remaining army reached Kandahar in late 1799, exhausted from the campaign.
Third campaign of Punjab
Zaman Shah set out his third campaign of Punjab in the spring of 1800, plotted to deal with a rebellious Ranjit Singh. However, having civil strife in Afghanistan, he was forced to cut his campaign short, having to deal with his brother, Mahmud Shah Durrani once again. Shah Zaman would not return to Punjab, and he would be deposed by Mahmud Shah.
Campaigns of Maharaja Ranjit Singh
In 1813, after demanding the return of the fort at Attock, the Durrani prime minister Wazir Fateh Khan besieged Attock. A Punjabi relief force arrived and for three months the two armies faced each other, neither side moving. As the heat from summer started to affect the armies, Dewan Mokham Chand marched his army to block the Afghans from getting water from the river. Without water the Afghan troops began to suffer dehydration, so they launched attack after attack towards the river, but were unable to break through. Chand, realizing the Afghans were weakened, charged his cavalry at the Afghans who broke and ran, losing two thousand men.
Accusing Ranjit Singh of treachery, Fateh Khan set off from Kashmir at the head of 15,000 cavalry in April 1813 and invested Attock Fort. At the same time Ranjit Singh rushed Dewan Mokham Chand and Karam Chand Chahal from Burhan with a force of cavalry, artillery, and a battalion of infantry to meet the Afghans.