By James Macharia
JOHANNESBURG (Reuters) - South Africa's ruling party was in a close race early on Saturday in two major cities after losing one other key municipality in its worst electoral performance since the end of apartheid.
The African National Congress has ruled virtually unopposed since it ended white-minority rule in 1994 with Nelson Mandela at its helm. But its grip on power is being shaken against the backdrop of high unemployment, a stagnating economy and a series of scandals that have dogged President Jacob Zuma.
- Celebrity deaths 2018: All the stars we lost too soon 45 Pictures
- Photos: Starbucks Reserve Roastery NYC reconnects you with your coffee 48 Pictures
The party was still leading in the overall count in the nationwide municipal vote, with 98 percent of ballots counted.
But it lost to the main opposition Democratic Alliance (DA) in the municipality of Nelson Mandela Bay, which includes the city of Port Elizabeth, a key manufacturing hub and port city.
"We've lost Nelson Mandela Bay, we've conceded that we've lost it," Deputy President Cyril Ramaphosa said.
The DA was also narrowly ahead in the country's economic hub of Johannesburg, while the ANC held a slim margin in Tshwane, home to the capital Pretoria.
The DA, which last year elected its first black leader, Mmusi Maimane, as part of its efforts to shake off its image as a party that mainly serves white interests, has retained control of Cape Town, which it has held since 2006.
"Now we've got to do everything in our power to make sure where we govern we govern well," said Maimane, who declared that his party had won in Tshwane, well before the final tally.
Final results are due late on Saturday.
The ANC has lost support among voters who feel their lives have not improved and the opposition has accused Zuma of mismanaging the economy. Millions of urban voters are now looking beyond its liberation struggle credentials and focusing on an economy teetering on the edge of a recession.
"The ANC may just become a rural party," said William Gumede, chairman of the Democracy Works Foundation, a think tank.
Voters are losing patience with Zuma, who rattled investors in December by changing finance ministers twice in a week, sending the rand currency plummeting. The rand has since recovered, and received a boost from the peaceful vote.
Zuma survived an impeachment vote in April after the Constitutional Court said he breached the law by ignoring an order to repay some of $16 million in state funds spent on renovating his private home. Zuma has since apologized and said he will repay some of the money as ordered by the court.
The radical leftist Economic Freedom Fighters (EFF) party led by Julius Malema, Zuma's one-time protege but now arch-foe, was running a distant third with about 10 percent of the vote.
Malema has drawn support with promises to redistribute among poor black people wealth still mostly in white hands - policies that both the DA and the ANC have not found palatable.
But neck-and-neck races between the ANC and DA in Johannesburg and Tshwane mean the EFF could be needed for coalitions there, but Malema has not said whom he would back.
"If anyone comes to us, we'll talk," Malema told reporters when asked whether he would join a coalition.
Robert Besseling, head of the EXX Africa business risk intelligence think tank, said the EFF will play "a key kingmaker role" in coalition-building negotiations.
"Ideologically, the EFF is closer to the ANC, though it will be loath to support the ANC which it has acrimoniously opposed in the National Assembly," he said.
(Additional reporting by Tanisha Heiberg and Nqobile Dludla; Writing by James Macharia)