JOHANNESBURG: South Africans vote in national and provincial elections on May 29 with opinion polls suggesting the governing African National Congress will lose its majority for the first time in the democratic era, while remaining the largest party.

Under South Africa's constitution, voters elect 400 members of the National Assembly, who then elect the president by a simple majority. In all previous elections since 1994, the ANC won and lawmakers elected the party's leader as president.

Here are scenarios that could unfold this time, depending on the electoral maths.

ANC OUTPERFORMS POLLS AND WINS

In recent months, several polls suggested ANC support was hovering around the 40% mark, which would represent a collapse from its performance in 2019, when it won 57.5% of the vote.

However, a tracking poll suggests ANC support has risen in the weeks leading up to election day. Analysts say the party has an unmatched grassroots campaigning machine, with activists going door-to-door in communities across the country.

Over the past four electoral cycles, the ANC's share of the vote gradually dropped, but never by more than five percentage points from one election to the next.

If the ANC wins a majority, it is highly likely that President Cyril Ramaphosa, the party leader, would be re-elected as head of state by the new National Assembly.

ANC LOSES MAJORITY AND RAMAPHOSA GETS OUSTED

If the ANC loses its majority by a wide margin and Ramaphosa is blamed, the party could seek to oust him as its leader and nominate someone else for the National Assembly to elect as South African president.

It would have to move quickly as the constitution says the new National Assembly must convene within 14 days of the election result being declared to elect a president.

Most analysts say this is unlikely unless the ANC vote share is around 40% or less, a worst-case-scenario for the party. A more probable scenario would be for Ramaphosa to hand over to a successor in an orderly transition part way through his term.

Whether Ramaphosa stays or goes, the overwhelmingly likely scenario is that he or the next ANC leader will be president after the election. There would have to be a colossal upset for another party to have a chance of winning the presidency.

Regardless of whether Ramaphosa or someone else is president, if the ANC loses its majority it will need support from one or more other parties to keep governing.

ANC NARROWLY LOSES MAJORITY AND SEEKS SMALL PARTNERS

If the ANC comes close enough to 50%, it will try to make a deal with small- or medium-sized parties to form a government.

Analysts say the socially conservative Inkatha Freedom Party (IFP), which is strong in KwaZulu-Natal province and is polling at about 5% nationally, could be the ANC's first choice, though the IFP leader says it would rather not prop up the ANC.

The two parties were in violent conflict during the final years of apartheid, but worked together in the government of national unity that was formed after the 1994 election.

Other potential partners include the small Muslim party Al-Jama'ah and the Patriotic Alliance, which draws its support from the mixed-race community.

ANC LOSES MAJORITY BY WIDER MARGIN AND SEEKS LARGER PARTNER

Depending on the numbers, the party may have no choice but to seek support from one of its larger rivals: the free-market Democratic Alliance (DA) or the Marxist Economic Freedom Fighters (EFF).

The price of a deal with either of those would likely be significant policy concessions by the ANC, as well as the offer of some senior government positions for their partner.

Analysts say it is difficult to envisage a stable arrangement under this scenario, and South Africa could be facing a period of unprecedented government volatility.

Investors and the business community would prefer a deal with the DA, which has said it would not rule one out. However, many analysts think the ideological divide between the ANC and the DA is so wide as to make a deal difficult or impossible.

Led by Julius Malema, a former leader of the ANC's youth wing, the EFF may be a more natural fit for the ANC, but relations are tense between Malema and some ANC factions.

The EFF said in April it would partner with the ANC if it got the powerful post of finance minister. The ANC, which has not disclosed its thinking on any non-majority scenario, would be unlikely to agree to this unless it were hugely weakened.

Steven Friedman, an academic affiliated with the University of Johannesburg and Rhodes University, said it was hard to imagine the ANC and the EFF governing together for five years.

He cited their inability last year to agree on a constitutional change on land reform even though their positions on the issue are closely aligned.