The white population of South Africa

The white population of South Africa, which first colonized the land then established apartheid as the legal code, was a small minority of the overall population. How did such a small part of the population (between 13-20%) manage to establish such an oppressive system against the majority?