The First Anglo-Afghan War of 1838–1842 was conducted with the intention of limiting Russian influence in the country and quelling raiding from across the border. Within four years the British were expelled. After the Indian Mutiny, the British launched a second invasion, the Second Anglo-Afghan War of 1878–1880, for much the same reasons but did not attempt to maintain a permanent presence. A third conflict broke out in 1919. It lasted for three months, from May to August, and ended in a compromise that saw Afghanistan reassert its independence and control over its relations with other countries while agreeing to a border with British India known as the Durand Line. This line is still the border between Pakistan and Afghanistan today.