The British Empire invaded Afghanistan twice - in 1838-1842 and in 1878-1881. In both cases, the purpose of the invasion was to distract from Russian influence and prevent it from gaining a foothold in a strategic region. In response to every invasion, the Afghan population rose up against their occupiers.
First British invasion
In 1838, Shah Dost Muhammad Khan, the ruler of Afghanistan, was unable to organize significant resistance and soon surrendered. The British army almost effortlessly occupied Ghazni, Kabul and Jalalabad. The British nominated the puppet emir Shah Shuja, who agreed to cede British hegemony.
However, most Afghans despised Shah Shuja for his political betrayal and rebelled against the British, whose army consumed basic food and supplies, which raised local prices so high that the local population in the capital of Kabul became impoverished.
In turn, the Islamic mullahs began to call for jihad - a holy war against the infidels. On November 1, 1841, in the wake of a popular uprising against the occupation, a group of militias attacked the British garrison in Kabul, killing hundreds of British troops. The British command decided to retreat from Kabul. Constant raids and ambushes by local militias during the harsh winter turned the retreat into flight. Fewer than 2,000 reached Jalalabad on January 12, 1842, and only 350 of them were fortunate enough to find refuge in Gundamack. Shah Shuja was killed.
The fate of the Kabul garrison shocked British officials in Calcutta and London, and British garrisons in Ghazni and Jalalabad were ordered to occupy Kabul and retaliate against the rebels. The garrison left Kabul in ruins and killed thousands of civilians, but the British admitted that they could only occupy Afghanistan at their own risk. In October 1842, all British troops returned to India.
Second British invasion
The second British invasion in 1878 followed a similar scenario.
Initially, the British Army expedition met minimal local resistance, and by January 1879 the Afghan cities of Jalalabad and Kandahar were under military control.
Afghan Emir Sher Ali Khan died on February 20, 1879. His son and heir, Yakub, capitulated by signing the Treaty of Gundamak with British forces, marking the end of Afghanistan's independence. A British mission was established in Kabul.
The military disaster during the first invasion of Afghanistan was not instructive for the British, who also ignored the growing popular resentment and hostility during the second invasion.
In September 1879, an uprising in Kabul caught the British occupiers by surprise when protesters ravaged British residences and Louis Cavagnari, the head of the British mission, was killed.
The British recaptured Kabul in October 1879, but even brutal repression did not hold back the Afghan people's liberation struggle. The number of Pashtun and Tajik guerrillas grew, as did the number of their attacks on the places of concentration of British colonial forces.
However, the Afghans did not have a leader capable of uniting the rebels. Abdurrahman Khan, the grandson of Emir Dost Mohammed, appeared in northern Afghanistan after 11 years of exile in Russian Turkestan, threatening to oust the British from Kabul. His rival, Ayub Khan, a powerful ruler of the western province of Herat, launched an offensive against Kandahar and completely defeated the British near the Afghan village of Meywand in July 1880.
Although the British succeeded in subsequent military confrontations with Afghan rebels, the popular uprising was not suppressed. In fact, by mobilizing military opposition, both khans took advantage of the popular wave of anti-British sentiment to conquer the Afghan crown.
In 1881, Queen Victoria of Britain officially recognized Abdurrahman Khan as Emir of Kabul and withdrew British troops to India, while Ayub Khan went into exile after a series of military defeats.
Outcome of interventions
Although the British were able to establish (albeit temporarily) their hegemony in Afghanistan, both British military interventions in Afghanistan met the same fate - defeat at the hands of massive popular resistance.