Task: Question Answering
Input (English): Context: Mohammad Yaqub Khan ( 1849 -- November 15 , 1923 ) was Emir of Afghanistan from February 21 to October 12 , 1879 . He was the son of the previous ruler , Sher Ali Khan . Mohammad Yaqub Khan was the governor of Herat province in Afghanistan and decided to rebel against his father in 1870 but was imprisoned in 1874 . The Second Anglo - Afghan War erupted in 1878 , leading Sher Ali Khan to flee the capital of Afghanistan , and eventually die in February 1879 in the north of the country . As Sher Ali 's successor , Yaqub signed the Treaty of Gandamak with the British in May 1879 , relinquishing solely the control of Afghanistan foreign affairs to the British Empire . An uprising against this agreement led by Ayub Khan in October of the same year led to the abdication of Yaqub Khan . He was succeeded by the new ruler , Amir Ayub Khan ., The two branches of the Barakzai dynasty (Translation of Barakzai: sons of Barak) ruled modern day Afghanistan from 1826 to 1973 when the monarchy ended under Musahiban Mohammad Zahir Shah. The Barakzai dynasty was established by Dost Mohammad Khan after the Durrani dynasty of Ahmad Shah Durrani was removed from power. During this era, Afghanistan saw much of its territory lost to the British in the south and east, Persia in the west, and Russia in the north. There were also many conflicts within Afghanistan, including the three major Anglo-Afghan Wars and the 1929 civil war., Sher Ali Khan(c. 1825  February 21, 1879) was Amir of Afghanistan from 1863 to 1866 and from 1868 until his death in 1879. He was the third son of Dost Mohammed Khan, founder of the Barakzai Dynasty in Afghanistan., Subject: mohammad yaqub khan, Relation: noble_family, Options: (A) barakzai dynasty (B) durrani
Output (English): barakzai dynasty