South Africans have been voting in local elections seen as a test for President Jacob Zuma and the ruling African National Congress.
The ANC has dominated the political landscape since the first all-race elections in 1994.
But Mr Zuma has had to weather scandal, after being ordered to repay taxpayers' money spent on his private home.
Polls show the ANC may lose control of three key cities - Pretoria, Johannesburg and Port Elizabeth.
Some senior ANC officials have said Mr Zuma should stand down because of the scandals and the country's weak economy. Analysts say such calls would increase if the ANC does badly in these elections.
Security is tight after a number of ANC local councillors were shot dead - thought to be the result of in-fighting - in the final weeks of campaigning.
The ANC, which led the fight against white minority rule, is under pressure from two parties - the Democratic Alliance and the Economic Freedom Fighters, who are competing in their first local elections under firebrand leader Julius Malema.
The economy is one of the main issues as people vote, with growth expected to be 0% this year, and unemployment at 27%.
Protests demanding better housing and amenities have also sprung up across South Africa.
ANC's toughest challenge: Milton Nkosi, BBC News, Soweto
In the Orlando West high school voting station, voting is more than just about municipal issues.
People here are voting for history too. They tell me that there was too much sacrifice under apartheid and although they are angry with their ANC, they are unwilling to openly support the Democratic Alliance, which they still see as a white party.
Others told me that they are voting to punish the ANC.
It reminds me of some of those who voted for Brexit as a protest vote about immigration but who did not actually want to leave the EU.
Some people are voting for the opposition to send a warning to the ANC about poor governance and corruption but they don't really want it out of power.
But whatever the reason, the ANC is facing its toughest contest since democracy came in 1994.
The vote comes a month after South Africa's treasury recommended President Zuma pay back $509,000 (£381,000) to the government for upgrades made to his private home.
The country's highest court ruled earlier this year that Mr Zuma repay some of the $23m of public funds spent on his house in 2009, ruling that he had violated the constitution by earlier failing to repay some of the money.
The upgrades included an amphitheatre, pool, chicken run and cattle enclosure. He had argued that the work was necessary for security reasons.
The next presidential elections are due in 2019 but Mr Zuma cannot stand because he is serving his second term.