Afghanistan was considered by the British as an independent state at the time although the British controlled its foreign affairs and diplomatic relations. Afghanistan had already ceded the regions of Quetta, Pishin, Harnai, Sibi, Kurram, and Khyber to the British Raj by the 1879 Treaty of Gandamak during the Second Anglo-Afghan War. The Durand Line left about half of the Pashtun homeland under British rule. In 1901, the Pashtun-majority North-West Frontier Province was formally created by the British administration on the British side of the Durand Line, although the princely states of Swat, Dir, Chitral, and Amb were allowed to maintain their autonomy under the terms of maintaining friendly ties with the British. The Waziristanis and other tribals, however, continued to resist British occupation even after Afghanistan had signed a peace treaty with the British.