JOHANNESBURG - The mayor of Cape Town announced her resignation on Sunday over a bitter dispute that has rocked South Africa’s main opposition party ahead of elections next year.

Patricia De Lille said she would step down on October 31 after reaching an agreement with the Democratic Alliance (DA), which had unsuccessfully tried to strip her of her party membership.

Allegations of corruption and financial mismanagement in De Lille’s administration have marred her tenure as mayor of South Africa’s second biggest city since 2011.

“I’ve always maintained that I’m innocent and the allegations against me have never been proven,” De Lille told a press conference in Cape Town.

The party has agreed to drop internal disciplinary charges against her as she steps down, in a bid to end the damaging row. “I can now get on with my life,” De Lille said.

De Lille was booted from her party in May after a radio interview in which she said she intended to quit the DA as soon as she “had cleared her name”.

But a court found in June that the DA had failed to follow proper procedures to expel her and ruled that her membership must be reinstated.

The 67-year-old has been accused of exposing the city to financial and reputational risk and of poor management of the city’s water crisis.

Cape Town has been battling a drought, flash floods and a high crime rate.

DA leader Mmusi Maimane said the party would “begin the process of electing a new mayor with immediate effect”.

“We pride ourselves as a party of clean government,” he said.

He added that he respected De Lille and “her contribution to the people of South Africa and the city of Cape Town”.

“It never is an easy one to take on one of your own... and it’s never easy when it’s one of the senior people in your organisation,” he added.