Ever since Afghanistan emerged as an independent nation in 1709, when the Ghilzai kicked out the Persians, its history has been written in the ancient hatred between these two groups. During most of that time, the country has been ruled by Durrani, who in 1775 moved its capital from the Ghilzai stronghold of Kandahar up to Kabul in the north. Nothing has more fired Ghilzai enmity than the many occasions when the Durrani have attempted to impose their rule from Kabul with the aid of "foreigners", either Tajiks from the north or outsiders such as the British, who invaded Afghanistan three times between 1838 and 1919 in a bid to secure the North-west Frontier of their Indian empire against the rebellious Ghilzai.