JOHANNESBURG — The African National Congress, the party that helped liberate black South Africans from white-minority rule but has become mired in corruption, endured its worst election since taking power after the end of apartheid, according to results released on Friday.

The A.N.C., the party of the nation’s liberation hero and first black president, Nelson Mandela, could once count on the unyielding loyalty of tens of millions of black South Africans who lived under apartheid.

But widespread anger over the stagnant economy and the brazen self-enrichment of the A.N.C.’s members have badly eroded the party’s standing, gradually chipping away at its ability to rack up big electoral victories on the basis of its history alone.

In the biggest shake-up of the nation’s post-apartheid political order, the A.N.C. lost power in at least one big black-majority city, Nelson Mandela Bay, for the first time.