Original sentence: A series of battles which swung both ways meant that the war lasted two years, before the British captured Kandahar in September 1881 and forced the Afghans to sign the Treaty of Gandamak.From this the Afghans agreed to let the British attain all of their geopolitical objectives.Most of the British and Indian soldiers withdrew from Afghanistan
Edited sentence: A series of battles which swung both ways meant that the war lasted two years, before the British captured Kandahar in September 1881 and the Treaty of Gandamak was signed.From this the Afghans agreed to let the British attain all of their geopolitical objectives but disallowed a British residency in Kabul.Most of the British and Indian soldiers withdrew from Afghanistan due to continued Afghan resistance