South Africa's governing African National Congress (ANC) looks set to lose its parliamentary majority for the first time since Nelson Mandela led it to victory at the end of the racist system of apartheid in 1994.
It would herald the end of the party's decades-long domination of South African politics, raise questions about the leadership of President Cyril Ramaphosa and usher in an era of coalition politics.
Here are three factors that explain how South Africa got here, why and what the future holds.
The ANC was once a revered liberation movement etched in the hearts of South Africans, but after three decades in power it has become synonymous with corruption and bad governance.
As a result it was punished in Wednesday's election, especially by young people who came out in large numbers to vote against the party - something they never did in previous elections.
"They are fed up with corruption, and are worst affected by unemployment. They turned on the ANC," said William Gumede, the chairman of the non-profit Democracy Works Foundation.
It marks a generational divide in South Africa - their parents are still loyal to the ANC, as they lived through apartheid and know, first-hand, the ANC's rich history as a liberation movement that freed black people from the chains of apartheid.
But the ANC's support among older voters has also declined, including in its rural heartlands.
"The ANC lost support in the big cities a long time ago. Now it is losing support in rural areas as well," Prof Gumede told the BBC.
The ANC reached its electoral peak in 2004 when it won 70% of the vote. It has lost support of 3% or 4% in each election since then, reaching 57% in the 2019 poll.
In this election, the collapse in its vote appears to be massive - anything from 8% to 15%.
Former President Jacob Zuma has made a huge impact in the election
South Africa's former President Jacob Zuma, 82, is back with a vengeance.
He was ousted by the ANC in 2018, amid allegations of corruption, which he denied. He was succeeded by President Cyril Ramaphosa.
About three years later, he was sentenced to 15 months in prison for contempt after he defied a court order to appear before an inquiry looking into corruption during his nine-year presidency.
President Ramaphosa released Mr Zuma after he served only three months of his sentence in an attempt to placate him and his angry supporters.
But he is likely to rue the decision, as Mr Zuma returned to the political frontline under the banner of a new party, uMkhonto we Sizwe (MK), or Spear of the Nation.
Results released so far suggest that the ANC has bled support mostly to MK, which could take control of KwaZulu-Natal province.
If this is borne out by the final result, Mr Zuma would become the political don of the province and it would give him a base from where to plot Mr Ramaphosa's downfall - his key objective.
His conviction means he is barred from taking a seat in the National Assembly but he is still able to pull the strings from behind the scenes.
MK's growth is extraordinary. It was registered only last September, with Mr Zuma announcing in December that he was joining it as he could not vote for a Ramaphosa-led ANC. Since then it has shaken up South African politics in a way that no new party has done in such a short period since the end of apartheid.
The South African Mail & Guardian newspaper's KwaZulu-Natal correspondent, Paddy Harper, said that MK had not only eroded the ANC's support, but also that of the radical Economic Freedom Fighters (EFF), South Africa's third-biggest party until now.
The results so far suggest that MK is challenging it for third spot in the national parliament.
In KwaZulu-Natal, the EFF's final vote could be in single digits if current trends continue, despite the fact that the party had launched its election campaign in the province in the hope of growing there, Mr Harper told the BBC.
The EFF and MK advocate similar economic policies, including the expropriation of white-owned land and nationalisation of key sectors of the economy.
But Mr Zuma won over EFF supporters in KwaZulu-Natal, his home province.
He infused his campaign with Zulu nationalism, invoking memories of the nation's founder, King Shaka, on the campaign trail.
The former president also pledged to increase the powers of all of South Africa's kings and chiefs, who currently have ceremonial powers and assist the government to bring about development in rural areas where they wield influence.
MK's manifesto pledged to "expropriate all land without compensation, transferring ownership to the people under the custodianship of the state and traditional leaders".
MK also campaigned on Mr Zuma's track-record in government, saying the economy has worsened under Mr Ramaphosa.
MK supporters also criticise Mr Ramaphosa for enforcing one of the world's strictest lockdowns during the Covid pandemic, saying it worsened poverty and unemployment.
President Cyril Ramaphosa's future could be in doubt once final results are released
South Africa's respected Council for Scientific and Industrial Research (CSIR) and the News24 website have projected that the ANC's final vote could be around 42%.
If this turn out to be the case, the result would be catastrophic for the ANC - and Mr Ramaphosa.
He could come under pressure from the party to resign, with his deputy, Paul Mashatile, being touted as a potential successor.
Mr Ramaphosa led the ANC into a lacklustre election campaign, and the party became so desperate that it got former President Thabo Mbeki - as well as other retired party leaders - to join the campaign in a bid to bolster its vote.
The president is widely seen as weak and indecisive. He has defended himself by saying his focus was on "social compacting", or building consensus.
"Those who would like a president who is dictatorial, who is adventurous, who is reckless, will not find that in me," he said, while on the campaign trail.
Mr Ramaphosa's chances of remaining in office will be stronger if the ANC gets between 45% and 50% of the final vote.
This is the result that many ANC members had resigned themselves to during the election campaign, and said the party could remain in power in coalition with smaller parties - like the Inkatha Freedom Party (IFP), which draws its support mainly from ethnic Zulus in KwaZulu-Natal, or the Muslim Al Jama-ah party.
But if the ANC falls below 45%, it is likely to need a big party as a coalition partner.
This could be either MK, the EFF or the main opposition Democratic Alliance (DA), which advocates centre-right policies such as greater privatisation and the scrapping of the minimum wage.
Any coalition deal at national level would be influenced by what happens in the provinces - especially the most populous ones of Gauteng, home to Johannesburg and Pretoria, and KwaZulu-Natal.
One possibility would be a coalition between MK and the ANC in both KwaZulu-Natal and nationally but given the fractious relations between the two parties, that appears unlikely.
Instead, the ANC could try to offer the DA and IFP a deal that would see the three parties governing jointly at national level, and in KwaZulu-Natal.
"The DA and IFP have kept that option open in order to keep the EFF and MK out of government," Mr Harper said.
The DA's support appears to have grown in this election, with the party having regained the votes of white people who backed a party to its right in the last election, and some black people who felt it needed to be given a chance in national government.
The ANC's other option is try to form a coalition with the EFF in the national government, as well as in Gauteng, where the ANC is also set to lose its outright majority.
ANC leaders in Gauteng, backed by Mr Mashatile, are said to prefer a coalition with the EFF. The two parties currently run Johannesburg city council together.
Mr Malema, a former ANC youth leader, is apparently open to the idea.
In South Africa's Daily Maverick news site earlier this month, journalist Ferial Haffajee wrote that the EFF leader - who was previously convicted of hate speech for singing the anti-apartheid song Shoot the Boer [a reference to white farmers] - was "more considered and less fury-filled" during the election campaign, and at a town hall meeting in April, he expressed the view that the EFF’s natural coalition partner is the ANC.
"Even if the business community and markets are spooked by an ANC-EFF coalition, its potential is clearly front and centre in Malema’s strategy to get to the Union Buildings [the seat of government]," Ms Haffajee wrote.
"Part of the ANC supports a coalition with the EFF. At the same time, Ramaphosa’s supporters in the ANC believe that such a coalition will cause an existential crisis for the culture of the old liberation movement," she added.
So, tough decisions lie ahead for the ANC following an election that sees South Africa enter a new era, with the opposition having the power to make or break the government.