The African National Congress has lost its grip on local government in Tshwane, home of South Africa's capital Pretoria, as results gave the opposition Democratic Alliance a second big win in the ANC's worst election since the end of apartheid.
The results have reshaped the political landscape in South Africa where the ANC has ruled virtually unopposed since it ended white-minority rule in 1994, led by Nelson Mandela.
Unemployment, a stagnating economy and scandals around President Jacob Zuma led voters to punish the ANC, changing the outlook for national elections in 2019 and potentially emboldening Zuma's rivals within the ANC to challenge him.
As final votes were counted, the ANC was leading in economic powerhouse Johannesburg by a slim margin. As well as defeat in Tshwane it lost Nelson Mandela Bay, which includes manufacturing hub Port Elizabeth, to the DA.
With 99 percent of votes counted from Wednesday's local elections, the ANC was leading with the most votes overall and said it would still try to form coalitions to govern the municipalities where it lost its majority.
Speaking at the results tallying centre in his first public remarks since the vote's outcome, Zuma said South Africa was a "democracy where differences of political opinion and diverse political preferences are allowed to flourish".
The DA, which fell short of a majority in both Tshwane and Nelson Mandela Bay, would also need to form coalitions to take power in those areas.
But the results mark a watershed for the DA which last year elected its first black leader, Mmusi Maimane, as it tries to shake off an image of a party mainly serving white interests.
The party held Cape Town, which it has controlled since 2006.
"It signals to everyone that the tide in our country is turning," Maimane told reporters on Saturday.
Paul Mashatile, the ANC chairman in Gauteng province, which includes Tshwane and Johannesburg, blamed the poor result on low voter turnout by ANC supporters countrywide.
"It's quite clear that our people, our traditional supporters, are still with us but maybe not too many people came out to vote so we need to go back and find out why."
Millions of urban voters are now looking beyond the ANC's liberation struggle credentials and focusing on an economy teetering on the edge of a recession.
Zuma rattled investors in December by changing finance ministers twice in a week, sending the rand plummeting.
The currency has since recovered and received a boost from the lack of violence during the local elections.
The president survived an impeachment vote in April after the Constitutional Court said he breached the law by ignoring an order to repay some of US$16 million (AU$21 million) in state funds spent on renovating his private home. Zuma has since said he will repay some of the money.
The radical leftist Economic Freedom Fighters (EFF) party led by Julius Malema, Zuma's one-time protege but now arch-foe, came a distant third in the local elections, with about 10 percent of the vote.