Cape Town is South Africa's oldest city, sometimes called the Mother City. Its formal history dates to 1652, when a colony was established by the Dutch; however, the local Khoi people had inhabited the area for thousands of years, archaeological evidence shows. Their interactions with Europeans date to the late 15th century, when the first Portuguese explorers clashed with them. By the mid-17th century, when the Dutch colony was started, decades of interaction including trade had been recorded.
For its first few centuries, Cape Town's existence centred on its strategic location - a sheltered harbour with reliable fresh water supplies, at a strategic point on the sea route between Europe and Asia. As chance had it, Cape Town is also the heart of a climatic and ecological zone distinct from the rest of South Africa, and in fact, from the rest of the world. The winter rainfall and dry summers have been labelled "Mediterranean", but the biology encountered by the settlers was totally unlike that of any Mediterranean area; it is recognised as the smallest of the six 'floral kingdoms' into which the earth's land masses are divided (it also had some distinctive animals, which didn't last long once firearms arrived).
The Cape's distinct climate had also shaped its demography in that the main grain crop grown in the rest of southern Africa, sorghum, would not grow there, so the Bantu-speaking groups had left it to the Khoi and San (pastoralists and hunter-gatherers respectively). These had no culture of military organisation, and their numbers were relatively small, making them more vulnerable to European colonisation.
Although by the time the Dutch colony started (1652) slavery had already become racialised, the category of Free Blacks (mostly ex-slaves and their descendants) existed and enjoyed similar rights to burghers ("white" settlers) - including the right to own slaves. In fact due to the shortage of "white" women, settler men often married former slave women and many "white" South African families have an ex-slave "oer-moeder" (meaning the first man of that surname in the country married her). In some cases such wives survived their husbands by considerable periods, and were able to continue building up their estates and at times, were amongst the wealthiest members of the small population. The colony's first and second governors, Simon van der Stel and his son Willem, were themselves of mixed descent (prior to Simon's appointment, the settlement merely had a commander, Jan van Riebeeck).
However, a smallpox epidemic struck and indigenous and Free Black residents (as well as nearby Khoi) were disproportionately struck down. Opportunist "whites" took advantage of this and installed more discriminatory laws and the die was cast, leading eventually to apartheid.