FiveThirtyEight has a really fascinating post of how Apartheid was an unpopular policy among the whites of South Africa. Some excerpts:
Compared to this, the National Party offered the promise of ending English dominance of the civil service and the economy as well ending the competition that African laborers moving to the urban areas posed to poor Afrikaner workers. When the votes were counted the United Party had won a large popular vote victory, 547,437 (50.9%) for the United Party to 443,278 (41.2%) for the National Party. But when the seats were declared, the National party and its allies had won 79, compared to 71 for the United Party and its allies.
Secondly, the National Party had the advantage of being an ethnic party in a country in which the ethnic balance favored them. Afrikaners, to whom they focused their appeal, made up 57% of the population, and were furthermore, better distributed for electoral purposes, making up the majority in 98 out of 150 seats. The redistricting that followed the Nationalist victory in 1948 only increased this discrepancy by adding six seats for Namibia, which was annexed in violation of UN resolutions calling for its independence.
Therefore, the results in the next two elections were even more disproportionate. In 1953, the opposition had united into the United Front, and had high hopes of victory, and with the unified support the South African business community and economic elite, they outspent the National party by nearly 4-1. Nevertheless, when the votes were counted the pattern of 1948 was repeated, only to an even greater extent than in 1948. In Cape Town the United Front won 73%; in Cape Elizabeth 65%. But in the rest of Cape Province, the National Party won 57% of the vote, and 29 out of 33 seats. The pattern was repeated nationwide. By 1958, the Opposition had all but given up serious hope of winning despite the fact that the results indicated that they still held the support of a majority of the electorate.
The greatest threat to the system was always naked demographics, and by giving no option to young whites for political change, it drove many of South Africa’s best and brightest towards emigration. By the 1970s it was not just English speakers who were leaving the country, but also young Afrikaners who wanted an opportunity to escape an Afrikaans-only educational system that the National party seemed determined to force them into.
By the end of the 1970s, the white population was actually falling by nearly 20,000 a year, a pace that would more than double by the beginnings of the 1980s. While the electoral system may have made it increasingly difficult for South Africans to oust the National government with their votes, it in many cases led them to vote against its system of Apartheid with their feet.
Like the Republic of South Africa, the United States of America also imposes unpopular, racially discriminatory laws which harm its competitiveness.