South Africa's opposition Democratic Alliance has won a closely-contested mayoral race in the city of Cape Town.
Helen Zille won the contest by three votes
DA mayoral candidate Helen Zille was elected by council members who were chosen in an election on 1 March.
No party achieved an outright majority on the council, and the last two weeks have seen intense negotiations as parties tried to reach a deal.
The outcome makes Cape Town the only major South African city headed by a mayor not from the governing ANC.
The DA secured the support of the smallest parties on the council to gather 106 votes in favour of Ms Zille, against 103 for ANC candidate Nomaindia Mfeketo.
The Independent Democrats, who won 23 council seats and were expected to play a kingmaker role in choosing the mayor, did not support the DA.
In her acceptance speech, Ms Zille said it would be a challenge to make multi-party democracy succeed in Cape Town.
"Our great challenge in Cape Town is to ensure that our diversity is not a weakness but what we claim it to be, our greatest strength," she told councillors. "We can make it work."
In a statement, the ANC congratulated Ms Zille and pledged to "continue to work with other parties to unite the people of Cape Town".
Earlier, a DA statement accused the ANC and Independent Democrats of "disgraceful behaviour" during the mayoral selection process.