After the death of Amir Shir Ali Khan, Abdur Rahman Khan, who was living in Samarqand at the time, returned to Afghanistan and took the Afghan throne in 1880. The second Anglo-Afghan war ended soon after his arrival on the scene. The British recognized him as the Amir of Afghanistan, and later brokered various agreements with him, including the famous Durand Line, which marks the border between Afghanistan and today. He also agreed to give the British complete control over Afghanistan’s foreign policy. In return the British supported him financially. Over time, he defeated his rivals and put down many rebellions. During his reign, Abdul Rahman centralized the government, and brought about various reforms. He also waged bloody wars with various minority ethnic groups in the country, which left thousands dead. He died in 1901.