South Africa's ruling African National Congress (ANC) was leading its rivals early on Thursday as vote counting proceeded in local government elections that could see it lose control of key cities for the first time since coming to power.
The party, which toppled white apartheid rule after the country's first democratic elections in 1994, is up against its stiffest electoral challenge to date against the backdrop of high unemployment, a stagnant economy and controversies surrounding President Jacob Zuma.
With a quarter of the votes in so far, the ANC held a 50 percent lead, against 34 percent for the Democratic Alliance (DA) and 6 percent for the Economic Freedom Fighters, which is participating in only its second election.
The ANC and DA were neck-and-neck at 43 percent each in Tshwane municipality, home to the capital Pretoria, although only 15 percent of the votes had been counted. The DA led with 61 percent versus 30 percent for the ANC in Nelson Mandela Bay, with a fifth of the votes in.
Opinion polls see a close race in Nelson Mandela Bay, named after the anti-apartheid champion and South Africa's first black president, as well as in Pretoria and South Africa's economic hub, Johannesburg.
A significant loss of support for the ruling party, which led South Africa's decades-long struggle against oppressive white minority rule, would be a blow ahead of the next major test - the 2019 national elections.
The ANC won an overall 62 percent of the vote in the last municipal elections in 2011, while the DA garnered 24 percent.
Final results for this year's election are expected by Friday.
The DA is expected to maintain control of Cape Town, the only big city not run by the ANC. It is an historically white-dominated movement hoping to expand support under its new black leader Mmusi Maimane.
"I voted DA because I'm sick of the rotten, corrupt ANC," said Simpiwe, an unemployed 55-year-old surrounded by shacks in a rundown Nelson Mandela Bay township on the southeast coast, after casting his ballot on Wednesday.
Many South Africans who queued up to vote said they were worried about Zuma's performance and the state of Africa's most industrialised economy, where one in four in the labour force is unemployed.
Senzo Makhubela, a 32-year-old security guard, said the ANC needed to build more houses and do more to develop areas like Diepsloot, the shantytown where he lives north of Johannesburg.
But he was sticking with the ruling party for now, despite the travails of its leader. "Zuma doesn't make decisions alone so the ANC is not Zuma alone, it's a collective," he said.
Zuma survived an impeachment vote in April after the Constitutional Court said he breached the law by ignoring an order to repay some of the $16 million in state funds spent on renovating his private home.
In December, he rattled investors after changing his finance minister twice in a week, sending the rand plummeting. The currency has since recovered.
Zuma has said he would repay some of the funds spent on his home and rejected criticism of his conduct, but anger is rising in a country on the brink of recession.
Analysts also predict a downgrade by credit ratings agencies to "junk" status later this year.
"A very weak outcome for the ANC, getting less than a 55 percent national vote share and losing three metros, would likely be viewed as a market positive," said Nomura emerging market analyst Peter Attard Montalto.