Between the early 16th century and the mid-18th century, the Province was ruled by the Khanate of Bukhara. It was given to Ahmad Shah Durrani by Murad Beg of Bukhara after a treaty of friendship was reached in or about 1750, and became part of the Durrani Empire. It was ruled by the Durranis followed by the Barakzai dynasty, and was untouched by the British during the three Anglo-Afghan wars that were fought in the 19th and 20th centuries. It remained peaceful for about one hundred years until the 1980s Soviet–Afghan War.