Question: What dynasty was founded by one of the prominent rulers of Afghanistan during the First Anglo-Afghan War, who had a  dispute with former emir Shah Shujah hom they installed upon conquering Kabul in August 1839?

The 1842 Kabul Retreat (or Massacre of Elphinstone's army) took place during the First Anglo-Afghan War.  At the beginning of the conflict, British forces had defeated the forces of Afghan Emir Dost Mohammad Barakzai and in 1839 occupied Kabul, restoring the former ruler, Shah Shujah Durrani, as emir.  However a deteriorating situation made their position more and more precarious, until an uprising in Kabul forced the then commander, Major General Sir William Elphinstone, to withdraw the garrison.  To this end he negotiated an agreement with Wazir Akbar Khan, one of the sons of Dost Mohammad Barakzai, by which his army was to fall back to the British garrison at Jalalabad, more than 90 mi away.  As the army and its numerous dependents and camp-followers began its march, it came under attack from Afghan tribesmen.  Many of the column died of exposure, frostbite or starvation or were killed during the fighting. <SEP>  With the decline of the Durrani dynasty, he became Emir of Afghanistan from 1826 to 1839 and then from 1843 to 1863.  An ethnic Pashtun, he was the 11th son of Sardar Payendah Khan (chief of the Barakzai tribe) who was killed in 1799 by Zaman Shah Durrani.  Dost Mohammad's grandfather was Hajji Jamal Khan. Dost Mohammad Khan (Pashto: دوست محمد خان‎ , December 23, 1793June 9, 1863) was the founder of the Barakzai dynasty and one of the prominent rulers of Afghanistan during the First Anglo-Afghan War. <SEP> The Emirate of Afghanistan (Pashto: د افغانستان امارت‎ "Da Afghānistān Amārat ") was an emirate between Central Asia and South Asia, which is today's Islamic Republic of Afghanistan.  The emirate emerged from the Durrani Empire, when Dost Mohammed Khan, the founder of the Barakzai dynasty in Kabul, prevailed.  The history of the Emirate was dominated by 'the Great Game' between the Russian Empire and the United Kingdom for supremacy in Central Asia.  This period was characterized by the expansion of European colonial interests in South Asia.  The Emirate of Afghanistan continued the war with the Sikh Empire, which led to the invasion of Afghanistan by British-led Indian forces who completely wiped out the Afghans in 1842 but did not fulfil their initial war objectives.  However, during the Second Anglo-Afghan War, the British again defeated the Afghans and this time the British took control of Afghanistan's foreign affairs until Emir Amanullah Khan regained them after the Anglo-Afghan Treaty of 1919 was signed following the Third Anglo-Afghan War. <SEP> The First Anglo-Afghan War (also known as Disaster in Afghanistan) was fought between British imperial India and the Emirate of Afghanistan from 1839 to 1842.  The war is notorious for the loss of 4,500 British and Indian soldiers, plus 12,000 of their camp followers, to Afghan tribal fighters, but the British defeated the Afghans in the concluding engagement.  Initially, the British successfully intervened in a succession dispute between emir Dost Mohammad (Barakzai) and former emir Shah Shujah (Durrani), whom they installed upon conquering Kabul in August 1839.  However, in 1841 the Army of the Indus, numbering between 24,000 and 28,000 including families of soldiers, military and political pundits, suffered a series of defeats at the hands of rebel Afghan tribesmen.  The main British Indian and Sikh force occupying Kabul, having endured harsh winters as well, was almost completely annihilated while retreating in January 1842.  It was one of the first major conflicts during the Great Game, the 19th century competition for power and influence in Central Asia between Britain and Russia.