The First Anglo-Afghan War lasted from 1839 to 1842.
Fearing increasing Russian influence in Afghanistan, the British resolved to depose Dost Muhammad and restore former ruler Shah Shuja.
In the opening campaign in 1839 the British captured Kandahar, Ghazni and Kabul, and captured Dost Muhammad, sending him to India. Having restored Shuja to the throne, the British withdrew, leaving two envoys and a garrison in Kabul.
In 1841 the Afghans rose against the British in Kabul, killing both the British agents and surrounding the garrison. In early 1842 the garrison surrendered, and was offered safe conduct to return to India. However, the British force was ambushed in the Khyber Pass and massacred.
In retaliation, the British reinvaded, relieving the besieged British garrison in Jalalabad, and then pushed on to Kabul. Ninety-five prisoners from the earlier massacre were rescued, and the British destroyed the citadel and central bazaar of Kabul. However, as Shah Shuja had been assassinated by this point, the British decided it was unprofitable to occupy the country and withdrew.
The disaster of the FirstAfghanWar was a substantial contributing factor to the outbreak of the Great Mutiny in the Bengal Army in 1857.
As part of the agreement with the Ameers all the guns had to be left to the Afghans except for one horse artillery battery and 3 mountain guns and a number of British officers and their families were required to surrender as hostages, taking them from the nightmare slaughter of the march into relative security.
The FirstAfghanWar provided the clear lesson to the British authorities that while it may be relatively straightforward to invade Afghanistan it is wholly impracticable to occupy the country or attempt to impose a government not welcomed by the inhabitants.
The Afghans, following the British and Indian troops to Jellalabad, harried the sappers with a constant fire, particularly from a neighbouring hill where they were inspired by a Ghilzai bagpiper until driven away by a sortie on 15th November 1841.
The Afghans surrounded the town but were pushed back by another determined sortie led by Colonel Dennie of the 35th BNI on 1st December 1841.