South Africa's President Cyril Ramaphosa has admitted his African National Congress (ANC) party has suffered a challenging election result after the party lost its majority for the first time since apartheid ended 30 years ago.
The ANC, once led by Nelson Mandela, won 159 seats in the 400-seat parliament in Wednesday's election, down from 230 in the previous assembly.
Mr Ramaphosa still described the results as a victory for democracy, calling on rival parties to find common ground - apparently preparing for coalition talks.
The opposition Democratic Alliance (DA) party has said it is open to coalition talks with Mr Ramaphosa, but it opposes a number of his government's key priorities.
With all the votes counted, the ANC finished at 40% - down from 58% in the previous election, the electoral commission announced on Sunday.
This was lower than the party's feared worst-case scenario of 45%, analysts said. The ANC now must go into a coalition to form the next government.
"Our people have spoken, whether we like it or not, they have spoken," Mr Ramaphosa said.
"As the leaders of political parties, as all those who occupy positions of responsibility in society, we have heard the voices of our people and we must respect their wishes."
He added that the voters wanted the parties to find common ground.
"Through their votes, they have demonstrated clearly and plainly that our democracy is strong and it is enduring," he said.
South Africa's political parties have two weeks to work out a coalition deal, then the new parliament will sit to choose a president.
The centre-right DA remains the second-largest party in parliament with 87 seats, and has said it is open to talks of a coalition.
"We urge all others who love our constitution and all it represents to set aside petty politics and narrow sectarian interests and join hands now," DA leader John Steenhuisen said.
However, his party opposes two of the ANC's key priorities - its black empowerment policies, which aim to giving black people a stake in the economy following their exclusion during the racist apartheid era, and the National Health Insurance (NHI) Bill, which promises universal healthcare for all.
The ANC has said both policies are non-negotiable in coalition talks.
Former president Jacob Zuma, who now leads the uMkhonto weSizwe (MK) party that came third with 58 seats, did not attend the results announcement and had suggested that he might challenge them.
The MK has said it would be prepared to work with the ANC, but not while it was led by Mr Ramaphosa.
He replaced Mr Zuma as both president and ANC leader following a bitter power struggle in 2018.
In a BBC interview, Patrick Gaspard, who was the US ambassador to South Africa in 2013-16, described the two politicians as "sworn enemies".
Earlier on Sunday, Mr Zuma called for an election rerun and said the electoral commission should not announce the final results.
On Saturday, he warned the commission that it would "be provoking us" if it ignored his demand for a fresh election, and for an independent investigation into his party's claims that it was rigged.
"Don’t start trouble when there is no trouble,” he said.
There are now concerns over how Mr Zuma's supporters may respond to the results.
The 82-year-old has been the political wildcard in this election - and he is preparing to flex his muscles as the kingmaker in his home province of KwaZulu-Natal, where the MK party has wrestled a huge chunk of votes from the ANC.
Formed just a few months ago, results show that for the national election, it has taken the largest share of the vote in the province - 44% to the ANC's 19%.
Local issues could have been a big factor in that shift, with some community members turning their backs on the ANC party because it had failed to fix acute water shortages.
Parts of the province, such as Trenance Park, which is a mere 20 minutes' drive from the main city of Durban, have had no tap water for 10 months.
Residents rely on water tankers that sometimes do not deliver water on time.
People in KwaZulu-Natal hope that now the election is over, the problem will be fixed for good.
Earlier, South Africa's police chief warned that threats to destabilise the country would not be tolerated.
"There cannot be any room for threats of instability in order to register objections or concerns about the electoral processes," Police Minister Bheki Cele said at a news conference.
The ANC has always polled above 50% since the country's first democratic elections in 1994, which saw Nelson Mandela become president.
But, support for the party has been dropping significantly because of anger over high levels of corruption, unemployment and crime.
"There are tens of millions of young people in that country who are called the Born Free generation, born after 1994 after the end of apartheid, and they feel that their country underwent a political transformation, but not an economic one," Mr Gaspard told the BBC.
He added that back in 2015 "it was already becoming abundantly clear that there was a downward trajectory for the ANC because it was failing to deliver on essential services in the country", specifically mentioning rolling blackouts.
BBC