In 1899 gold led directly to the Anglo-Boer War that lasted three years. President Paul Kruger of the ZAR and the High Commissioner of the Cape Colony, the imperialist Lord Milner, failed to agree on rights for the "Uitlanders". That induced Kruger to pre-empt a British declaration of war in 1899.
The war, that lasted three years, was the first war where trenches were used, and it developed into probably the first real guerrilla-style warfare. In the end, the so-called "scorched earth" policy of the British, with the resultant concentration camps for Whites and labour camps for Blacks, led to the signing of the Peace Agreement of Vereeniging in 1902.
The peace agreement was generous to the losers, and the four colonies (Cape, Natal, Orange Free State and Transvaal) met at a National Convention in 1908 to lay the foundation of a new country. On 31 May 1910 the Union of South Africa, a self-governing dominion within the British Empire, came into being.
The majority Black population, however, was virtually excluded from the negotiations leading to Union, and the result was that they were deprived of more land. Black dissatisfaction resulted in the formation of the South African National Native (later African National) Congress (ANC) as early as 1912, as well as the South African Communist Party.