South Africa has taken a unique path through modern history. While most of Africa consisted of European colonies until the 1950s and 60s, South Africa was an autonomous dominion under the British Crown from 1910, and independent from 1931. From 1948 to 1994, the apartheid policy of racial segregation caused tension within the country, and between the country and much of the rest of the world. The country peacefully transitioned from white minority rule to non-racial democracy under the leadership of Nelson Mandela and the African National Congress, yet it still struggles with racial tension and the remnants of the apartheid system are visible everywhere as a memorial to official racism.
See also: Ancient African nations
As South Africa has cooler climate than tropical Africa, and made for a strategic outpost on the Cape Route between Europe and Asia, it was one of the first parts of Africa to be colonized by Europeans, long before the scramble for Africa of the late 19th century. It was also one of only a handful of African countries to attract significant numbers of European immigration during colonialism and one of even fewer to still retain a significant white minority today. Rivalry between the British Empire and the Boers (Dutch colonists) led to the Boer Wars from 1880 to 1902, where the British Empire came to control all of South Africa.
The Union of South Africa was founded in 1910, as a self-governing British Dominion. The country became sovereign in 1931, and was one of very few independent countries on the continent during the imperialist years. South Africa was an ally of the United Kingdom in both World War I and World War II (see World War II in Europe and World War II in Africa). However, during the latter war, deep political rifts between the Afrikaner (Afrikaans speaking descendants of mostly Dutch colonists) and English-speaking South Africans became apparent over the issue of either joining the allied side (as English-South Africans mostly wanted) or staying neutral (as most Afrikaners wanted). During the war, the country was still governed by "unity governments".
In 1948, the Afrikaner-dominated National Party rose to power, instituting the infamous apartheid policy. In 1961 the South African Republic was founded following a (whites only) referendum, as the National Party government got into conflicts with the British government mostly over Apartheid. South Africa consequently left the Commonwealth, and became further isolated from the Anglophone community.
While Apartheid seemed to only get further entrenched in the 1960s and 70s, slowly but surely opposition began to rise both inside the (whites only) Parliament and outside of it. The main anti-Apartheid movement was the African National Congress (ANC) led by Nelson Mandela. However, Apartheid was a consequence of – and enabled by – global political developments. When Apartheid was first formulated, most of South Africa's northern neighbours were governed by either European colonial regimes (such as Mozambique which was ruled by Portugal) or white minority regimes (such as Rhodesia, the modern Zimbabwe), while Namibia was an outright colony of South Africa. While the ANC was allied with the South African communist party (and both were subsequently outlawed), the Apartheid government was tacitly and sometimes openly supported by Western nations such as the US or Great Britain and often pro- and anti-Apartheid voices clashed hundreds of miles from South Africa, such as it occurred during a Springbok (the South African Rugby Union team) tour of New Zealand when sports fans clashed with anti-Apartheid protestors.
Many decolonized African countries became ruled by socialist regimes, supported by the Soviet Union. South Africa battled some of these, known as the Frontline States, notably Angola and Mozambique, and was functionally a Western ally against the Soviets in the Cold War (with some opposition and solidarity movements in the West siding against West-sponsored militia). The decline of global socialism in the 1980s might have contributed to increased Western pressure on South Africa. But the political landscape inside South Africa also changed, with the National Party paying lip-service to reforms and the hard line Apartheid supporters actually organizing outside the National Party in parliamentary groups like the Conservative Party (official opposition 1982–1989) as well as paramilitary groups.
Democratic reforms were suggested in the 1980s by white progressives, supported by the ANC, and the international community. There was even a "referendum" of the white population whether the negotiations to end Apartheid should continue. The first universal elections were held in 1994.
The transgressions of the apartheid era are investigated by a Truth and Reconciliation Commission, which inspired similar projects in other countries.
Following the democratization, South Africa has become an open society, and an integrated part of the international community, with rise of tourism, and events such as the 2010 FIFA World Cup. As of the early 21st century, the country faces challenges of corruption, poverty, high national debt, water shortage, multilateral racial tension and extremely high violent crime rates, heading for an uncertain future.
Safety concerns in South Africa are covered in South Africa#Stay safe.