Course of the War:

Two British forces marched into the interior of Afghanistan, and occupied important positions. Shere Ali fled from his capital, and died in February 1879. By the Treaty of Gandamuk, May 1879, Yakub Khan was recognized as Amir, and he agreed that a British envoy should reside at his Court. In September 1879, the envoy, his staff, and his escort were massacred. A fresh expedition was sent under Sir F. Roberts, who entered Kabul. In 1880, Abdur Rahman, nephew of Shere Ali, returned from exile in Russia and established himself in the northern provinces. The British Government came to an agreement with him, and he was recognized as Amir. In July 1880 Ayub Khan, another son of Shere Ali, defeated a British force at Maiwand. Roberts reached Kandahar from Kabul by a rapid march, and defeated Ayub Khan on September 1, 1880. Again, in July 1881, Ayub Khan returned and took possession of Kandahar, but was finally routed by Abdur Rahman in September.