Ahmad Shah Abdali, the founder of the modern Afghan state, died in 1772. During his reign of 25 years, he invaded Punjab and North India 10 times. He annexed Punjab up to Sirhind and conquered Kashmir. Sindh also acknowledged his suzerainty and paid tribute. However, his control over Punjab was precarious and he could not subdue the Sikhs. You can see the details in my previous post:
Abdali was succeeded by his son Timur Shah. He was born in Mashhad in 1746. He had accompanied his father in some of his campaigns. In 1757 he was appointed the viceroy of Punjab at the age of eleven years, with Jahan Khan serving as his deputy. However, he was evicted from Lahore by the combined forces of Adina Beg and Marathas the next year. He was the governor of Herat when Abdali died. However, before his death, he nominated Timur Shah as his successor. Even so, his accession was not without some trouble. It is significant to note that he shifted the capital to Kabul from Kandahar.
Timur Shah was a man of peaceful disposition, but could not remain aloof from the politics of Punjab. The Sikh influence and power were rising day by day and Afghans were determined to wrest the control of Punjab back from the Sikhs.
1. The First Invasion (1774 - 1775)
Faizullah Khan Khalil, chief of the Mohmand tribe, invited Timur Shah to invade Punjab and assured him of full support. Timur started his march from Kabul in November 1774 and reached Peshawar. He crossed Attock in January 1775 and defeated Milkha Singh, the Sikh Sardar of Rawalpindi. The Sikhs retired to the Chenab. However, Timur Shah due to his inadequate army and the audacity of the Sikhs, decided not to march any further and retired to Peshawar.
2. The Second Invasion (1779 - 1780)
Timur Shah left Kabul in October 1779 and halted at Peshawar. His target for this expedition was the conquest of Multan, which was in the hands of the Sikhs. His advanced army under Zangi Khan defeated an army of Sikhs at Rohtas. Timur himself marched towards Multan and laid siege to the city in January 1780. A large army of the Sikh confederacy came from Lahore to relieve the Sikh garrison at Multan. Timur Shah intercepted this relieving force at Shujaabad and defeated it decisively on 8th February 1780. The Sikhs retreated to Lahore.
The city fell to the Afghans in a few days. Timur ordered a general massacre in the city and the people suffered terribly. The Sikh garrison took shelter in the citadel. That too was surrendered on 18th February 1780 and the Sikhs were allowed to leave under the terms of capitulation. After staying for two weeks at Multan Timur retired to Afghanistan.
3. The Third Invasion (1780 - 1781)
The third campaign of Timur Shah was primarily aimed at Bahawalpur. He reached Multan in late 1781. Nawab Muhammad Bahawal Khan who was tributary to Ahmad Shah had stopped paying tribute to Timur. On the approach of the Afghan army, the Nawab retired to a fort deep in the desert, along with his family, treasure, and army. Bahawalpur city was plundered by the Afghans. However, the Nawab could not withstand the determination of Timur to subdue him and sued for peace and agreed to pay the tribute, including the arrears. At the conclusion of this campaign, Timur returned to Peshawar on his way to Kabul.
4. The Fourth Invasion (1785)
Timur Shah reached Peshawar in December 1785. He wanted to subdue the Sikhs in Punjab with the help of Shah Alam II, the Mughal Emperor, and other local chiefs. But could not forge an alliance. He recovered Kashmir from its rebellious governor and returned to Kabul in May 1786, to face troubles on his northern borders.
5. The Fifth Invasion (1788)
The fifth invasion started in late 1788 and the Afghans crossed the Indus at Attock in November 1788. This campaign was launched to settle the matters at Delhi Darbar and to support Jodhpur state in her conflict with Marathas. But he could not go beyond Bahawalpur, which was once again sacked, and the Nawab was forced to pay his arrears in tribute. Sind was also forced to pay six million rupees in tribute. This proved to be his last campaign in India, though there were many false alarms in the future.
In early 1793 Timur Shah was contemplating his next campaign when he was taken ill at Peshawar and retired to Kabul, where he died on the 18th of May 1793. He was succeeded by his son Shah Zaman.
6. The Sixth Invasion (1796 - 1799)
After consolidating his power in Afghanistan, Shah Zaman started his campaign in 1796 and captured Lahore in January 1797, without resistance, as the Sikh abandoned the city and retired to Amritsar. Shah Zaman tried to march on Amritsar but failed. Due to internal problems in Afghanistan, he soon returned. His appointed governor was killed by the Sikhs and the city was lost to them again.
7. The Seventh Invasion (1798 - 1799)
Shah Zaman again captured Lahore in the autumn of 1798, but due to the fierce resistance and being unable to overcome the guerrilla tactics of the Sikhs, he again retired to Afghanistan. Thus, this campaign too proved to be a failure and he could not march to Delhi, as he originally intended.
This was the last campaign of Shah Zaman, and indeed the last one from an Afghan ruler or anyone else from the North West. Now the tide turned decisively in favour of the Sikhs and actually, they expanded westward for the next half a century. Shah Zaman himself lost his throne in 1801 and escaped to Punjab. He lived in exile for the rest of his life in Ludhiana and died in 1844.
I took most of the information from the book of Hari Ram Gupta, Later Mughal History of Panjab, and also took some help from Wikipedia.