Diamonds and gold were found in many places around Africa during 1860s. The coveted materials contributed to the Europeans starting to invest in railways to South Africa in the 1870s. The Boers dismissed the western gold diggers and to top it off Cape Town tried to attract them into a southern african union where black people also would have a right to vote.
The British, who were building up a colonial empire in South Africa, did not like the Boer people's advance.Therefore, in 1879, a British army of 5,000 men attacked the Boer. The British were so sure to win that they behaved very casually. When the war broke out, the British were quickly defeated. More than a thousand British soldiers were killed.
After winning the fight against the British the Boer were then allowed to retain their power in Transvaal.