During the nineteenth century, two large European empires vied for dominance in Central Asia. In what was called the "Great Game," the Russian Empire moved south while the British Empire moved north from its so-called crown jewel, colonial India. Their interests collided in Afghanistan, resulting in the the First Anglo-Afghan War of 1839 to 1842.
Background to the First Anglo-Afghan War:
In the years leading up to this conflict, both the British and Russians approached Afghanistan's Emir Dost Mohammad Khan, hoping to form an alliance with him. Britain's Governor-Gneral of India, George Eden (Lord Auckland), grew extremely concerned with he heard that a Russian envoy had arrived in Kabul in 1838; his agitation increased when talks broke down between the Afghan ruler and the Russians, signaling the possibility of a Russian invasion.
Lord Auckland decided to strike first in order to forestall a Russian attack. He justified this approach in a document known as the Simla Manifesto of October, 1839. The manifesto states that in order to secure a "trustworthy ally" to the west of British India, British troops would enter Afghanistan to support Shah Shuja in his attempts to retake the throne from Dost Mohammad. The British weren't invading Afghanistan, according to Auckland - just helping out a deposed friend and preventing "foreign interference" (from Russia).
The British Invade Afghanistan:
In December of 1838, a British East India Company force of 21,000 mainly Indian troops began to march northwest from the Punjab. They crossed the mountains in the dead of winter, arriving at Quetta, Afghanistan in March of 1839. The British easily captured Quetta and Qandahar, and then routed Dost Mohammad's army in July. The emir fled to Bukhara via Bamyan, and the British reinstalled Shah Shuja on the throne thirty years after he had lost it to Dost Mohammad.
Well satisfied with this easy victory, the British withdrew, leaving 6,000 troops to prop up Shuja's regime. Dost Mohammad, however, was not ready to give up so easily, and in 1840 he mounted a counter-attack from Bukhara, in what is now Uzbekistan. The British had to rush reinforcements back into Afghanistan; they managed to capture Dost Mohammad, and brought him to India as a prisoner.
Dost Mohammad's son, Mohammad Akbar, began to rally Afghan fighters to his side in the summer and autumn of 1841 from his base in Bamyan. Afghan discontent with the continued presence of foreign troops mounted, leading to the assassination of Captain Alexander Burnes and his aides in Kabul on November 2, 1841; the British did not retaliate against the mob that killed Captain Burnes, encouraging further anti-British action.
Meanwhile, in an effort to soothe his angry subjects, Shah Shuja made the fateful decision that he no longer needed British support. General William Elphinstone and the 16,500 British and Indian troops on Afghan soil agreed to begin their withdrawal from Kabul on January 1, 1842. As they made their way through the winter-bound mountains toward Jalalabad, on January 5th a contingent of Ghilzai (Pashtun) warriors attacked the ill-prepared British lines. The British East India troops were strung out along the mountain path, struggling through two feet of snow.
In the melee that followed, the Afghans killed almost all of the British and Indian soldiers and camp followers. A small handful were taken prisoner. The British doctor William Brydon famously managed to ride his injured horse through the mountains and report the disaster to British authorities in Jalalabad. He and eight captured prisoners were the only ethnic British survivors out of about 700 who set out from Kabul.
Just a few months after the massacre of Elphinstone's army by Mohammad Akbar's forces, the new leader's agents assassinated the unpopular and now defenseless Shah Shuja. Furious about the massacre of their Kabul garrison, the British East India Company troops in Peshawar and Qandahar marched on Kabul, rescuing several British prisoners and burning down the Great Bazaar in retaliation. This further enraged the Afghans, who set aside ethno-linguistic differences and united to drive the British out of their capital city.
Lord Auckland, whose brain-child the original invasion had been, next concocted a plan to storm Kabul with a much larger force and establish permanent British rule there. However, he had a stroke in 1842 and was replaced as Governor-General of India by Edward Law, Lord Ellenborough, who had a mandate to "restore peace to Asia." Lord Ellenborough released Dost Mohammad from prison in Calcutta without fanfare, and the Afghan emir retook his throne in Kabul.
Consequences of the First Anglo-Afghan War:
Following this great victory over the British, Afghanistan maintained its independence and continued to play the two European powers off of each other for three more decades. In the meantime, the Russians conquered much of Central Asia up to the Afghan border, seizing what is now Kazakhstan, Uzbekistan, Kyrgyzstan, and Tajikistan. The people of what is now Turkmenistan were the last vanquished by the Russians, at the Battle of Geoktepe in 1881.
Alarmed by the tsars' expansionism, Britain kept a wary eye on India's northern borders. In 1878, they would invade Afghanistan once again, sparking the Second Anglo-Afghan War. As for the people of Afghanistan, the first war with the British reconfirmed their distrust of foreign powers, and their intense dislike of foreign troops on Afghan soil.
British army chaplain Reverand G.R. Gleig wrote in 1843 that the First Anglo-Afghan War was "begun for no wise purpose, carried on with a strange mixture of rashness and timidity, [and] brought to a close after suffering and disaster, without much glory attached either to the government which directed, or the great body of troops which waged it." It seems safe to assume that Dost Mohammad, Mohammad Akbar, and the majority of Afghan people were much better pleased by the outcome.