During the 1830s, approximately 12,000 Boers (later known as Voortrekkers), departed from the Cape Colony, where they had been subjected to British control. They migrated to the future Natal, Orange Free State, and Transvaal regions. The Boers founded the Boer Republics: the South African Republic (now Gauteng, Limpopo, Mpumalanga and North West provinces) and the Orange Free State (Free State).
The discovery of diamonds in 1867 and gold in 1884 in the interior started the Mineral Revolution and increased economic growth and immigration. This intensified the European-South African subjugation of the indigenous people. The struggle to control these important economic resources was a factor in relations between Europeans and the indigenous population and also between the Boers and the British.
The Boer Republics successfully resisted British encroachments during the First Boer War (1880–1881) using guerrilla warfare tactics, which were well suited to local conditions. The British returned with greater numbers, more experience, and new strategy in the Second Boer War (1899–1902) but suffered heavy casualties through attrition; in spite of which they were ultimately successful.
Within the country, anti-British policies among white South Africans focused on independence. During the Dutch and British colonial years, racial segregation was mostly informal, though some legislation was enacted to control the settlement and movement of native people, including the Native Location Act of 1879 and the system of pass laws. Power was held by the ethnic European colonists.
After four years of negotiating, the South Africa Act 1909 created the Union of South Africa from the Cape and Natal colonies, as well as the republics of Orange Free State and Transvaal, on 31 May 1910, eight years after the end of the Second Boer War. The newly created Union of South Africa was a British dominion. The Natives' Land Act of 1913 severely