Barakzai dynasty
The Emir Dost Mohammed Khan (1793–1863) gained control in Kabul in 1826 and founded () the Barakzai dynasty. Rivalry between the expanding British and Russian Empires in what became known as "The Great Game" significantly influenced Afghanistan during the 19th century. British concern over Russian advances in Central Asia and over Russia's growing influence in West Asia and in Persia in particular culminated in two Anglo-Afghan wars and in the Siege of Herat (1837–1838), in which the Persians, trying to retake Afghanistan and throw out the British, sent armies into the country and fought the British mostly around and in the city of Herat. The first Anglo-Afghan War (1839–1842) resulted in the destruction of a British army; causing great panic throughout British India and the dispatch of a second British invasion army. The Second Anglo-Afghan War (1878–1880) resulted from the refusal by Emir Shir Ali (reigned 1863 to 1866 and from 1868 to 1879) to accept a British mission in Kabul. In the wake of this conflict Shir Ali's nephew, Emir Abdur Rahman, known by some as the "Iron Emir",