<P> The first humans are believed to have inhabited South Africa more than 100,000 years ago . The historical record of this ethnically diverse country is generally divided into five distinct periods: the pre-colonial era, the colonial era, the post-colonial and apartheid eras, and the post-apartheid era . Much of this history, particularly of the colonial and post-colonial eras, is characterised by clashes of culture, violent territorial disputes between European settlers and indigenous people, dispossession and repression, and other racial and political tensions . </P> <P> The discoveries of diamonds and gold in the nineteenth century had a profound effect on the fortunes of the region, propelling it onto the world stage and introducing a shift away from an exclusively agrarian - based economy towards industrialisation and the development of urban infrastructure . The discoveries also led to new conflicts culminating in open warfare between the Boer settlers and the British Empire, fought essentially for control over the nascent South African mining industry . </P> <P> Following the defeat of the Boers in the Anglo - Boer or South African War (1899--1902), the Union of South Africa was created as a dominion of the British Empire in terms of the South Africa Act 1909, which amalgamated the four previously separate British colonies: Cape Colony, Natal Colony, Transvaal Colony, and Orange River Colony . The country became a self - governing nation state within the British Empire, in 1934 following enactment of the Status of the Union Act . The dominion came to an end on 31 May 1961 as the consequence of a 1960 referendum, which legitimised the country becoming a sovereign state named Republic of South Africa . A republican constitution was adopted . </P> <P> From 1948--1994, South African politics were dominated by Afrikaner nationalism . Racial segregation and white minority rule known officially as apartheid, an Afrikaans word meaning "separateness", came into existence in 1948 (under British rule), and became an official law of segregation when South Africa became a republic . It was an extension of segregationist legislation enacted in 1960 . On 27 April 1994, after decades of armed struggle and international opposition to apartheid, during which military and political support was provided primarily by the Soviet Union to the non-racial African National Congress (ANC), the ANC achieved victory in the country's first democratic election in which all races could vote . Since then, the African National Congress has dominated the politics of South Africa, in an uneasy alliance with the South African Communist Party and the Congress of South African Trade Unions . </P>

When did south africa stop being a british colony