JOHANNESBURG — South Africa's president on Sunday vowed to purge his party of "bad and deviant tendencies" as he prepares to appoint a new Cabinet following a victory in national elections.

The 57 percent share of the vote was the worst-ever election showing for the African National Congress, the party of the late Nelson Mandela which has ruled since the harsh apartheid system of racial discrimination ended 25 years ago. The party won 62 percent of the vote in 2014.

Low voter turnout of 65 percent in the May 8 election also reflected the frustration of many South Africans after corruption scandals around the ANC that led former president Jacob Zuma to resign last year under party pressure. Turnout was 74 percent in 2014.

In his first speech to supporters since the election win, current President Cyril Ramaphosa said he will not appoint leaders who work "to fill their own pockets."

He told thousands of supporters in downtown Johannesburg that "we are going to end corruption whether they like it or not." The revelations by a government commission investigating graft, often aired live on television for fascinated South Africans, "must be things of the past," the president said.

Ramaphosa, a Mandela protege, has vowed to clean up the rot and apologized to South Africans. But his new five-year term is threatened by Zuma allies within the ANC's leadership, who could pressure the party to oust him from power.

Observers have said South Africa's economy, the most developed in sub-Saharan Africa, would be further weakened if Ramaphosa is removed by his own party. He narrowly won the party leadership in late 2017, weeks before Zuma was pushed out.

Ramaphosa on Sunday urged ANC leaders to not hang the party's "dirty linen in public" and said the party must be renewed "so that we cleanse it of all the bad and deviant tendencies."

In South Africa, the president and parliament are not elected directly. The number of votes won by each party determines how many representatives are sent to the national 400-seat legislature. The president of the country is the leader of the party that gets the most votes.

The ANC slipped to holding 230 parliament seats, while the main opposition Democratic Alliance now holds 84 and the populist Economic Freedom Fighters have 44. The EFF gained ground in just its second presidential and parliamentary election, winning 10.7 percent of the vote, up from 6.3 percent five years ago.