CAPE TOWN, South Africa (Reuters) - The African National Congress (ANC) was holding last-minute talks with other parties on Thursday to thrash out a deal on who will be included in South Africa's next government in time for the convening of the newly elected parliament on Friday.

The ANC, a former liberation movement that has been in power since the end of apartheid 30 years ago, lost its majority in a May 29 election that tipped the country into a state of political uncertainty unseen in the democratic era.

Lawmakers are scheduled to convene on Friday in Cape Town to elect their speaker, deputy speaker and the country's president -- putting pressure on the ANC and other parties to decide who will govern. The parties were likely to announce their decision on Thursday evening.

President Cyril Ramaphosa, the ANC leader, is expected to win a new term in office, but the composition of the new government remains unclear.

The ANC said last week it favoured a broad-based government of national unity and was talking to parties ranging from the white-led, pro-business Democratic Alliance (DA) to its polar opposite, the hard-left Economic Freedom Fighters (EFF).

The clearest indication to date of who might have a seat at the table came from the Inkatha Freedom Party (IFP), which said on Wednesday it was prepared to join the ANC and DA in a governing alliance. However, neither of those parties has confirmed that they had agreed to govern together.

The ANC remains the largest party, having won 159 out of 400 seats in the National Assembly. The DA is its nearest rival, with 87 seats, while the populist uMkhonto we Sizwe (MK) party led by former President Jacob Zuma has 58.

The EFF came fourth, winning 39 seats, and the IFP fifth with 17.

If confirmed, a government involving the DA would be welcomed by big business and financial markets, which approve of its free-market policies.

However, it would be unpopular with many ANC supporters who see the DA as a defender of the interests of the privileged white minority - a toxic issue in a country still processing the legacy of the racist colonial and apartheid eras.

Analysts say the inclusion of the IFP, a socially conservative party with an ethnic Zulu base, could help the ANC leadership by sweetening the DA pill for its grassroots supporters.

WHAT WILL MK DO?

The ANC's governing body, the National Executive Committee, is scheduled to meet in Cape Town between 4:30 and 7:00 p.m. (1430-1700 GMT) to consider the result of negotiations with other parties and make decisions.

The ANC will hold a press conference afterwards, and other parties were also expected to make public statements later on Thursday ahead of the parliamentary deadline.

One major element of uncertainty is the attitude of Zuma's party, MK, which came a surprisingly strong third in the election but has nevertheless alleged vote-rigging took place and has threatened to boycott the new parliament.

MK applied to the Constitutional Court to stop parliament from convening on the grounds that the election was not free and fair, but the court dismissed its application on Wednesday, saying it was without merit.

The ANC and other parties have said they made overtures to MK but it was not receptive, so barring a dramatic reversal the party is not expected to form part of the national government.

However, MK's commanding position in Zuma's home province, populous KwaZulu-Natal, means it cannot be ignored.

MK won 45.4% of the provincial vote in KwaZulu-Natal, where the economically important ports of Durban and Richard's Bay are located, trouncing the IFP, which got 18.1%, and the ANC which came third with 17.0%.

With no party holding a majority in the provincial legislature, it was unclear whether MK would work with anyone else to take control of the provincial government or whether other parties would ally to shut out MK.

Such an anti-MK alliance could cause serious trouble in KwaZulu-Natal, where Zuma's supporters rioted in 2021 following news that he had been jailed for refusing to give evidence at a public inquiry into corruption during his time as president.

Zuma came to power in 2009 but was forced to quit in 2018 following a string of scandals. The ex-president, who has always denied any wrongdoing, has since fallen out with the ANC and is openly contemptuous of his successor, Ramaphosa.

(Reporting by Johannesburg bureau; Writing by Estelle Shirbon; Editing by Frances Kerry)

By Wendell Roelf