South African President Jacob Zuma's anti-corruption investigator has resigned after becoming embroiled in a row about ex-President Thabo Mbeki.
Willem Heath has quit because his position has become "untenable", Justice Minister Jeff Radebe said.
Mr Heath had accused Mr Mbeki of initiating rape and corruption charges against Mr Zuma while he was president.
Mr Zuma was elected president in 2009 following a bitter power struggle with Mr Mbeki.
A court acquitted Mr Zuma of raping a female friend, while corruption charges related to a controversial multi-billion dollar arms deal were dropped shortly before the elections.
Mr Zuma appointed Mr Heath only last month to head the anti-corruption Special Investigating Unit.
A former judge, Mr Heath served as an anti-corruption investigator after the end of apartheid under ex-President Nelson Mandela.
In an interview with South Africa's City Press newspaper earlier this month, Mr Heath said that Mr Mbeki had allegedly initiated the investigations against Mr Zuma.
He also claimed that Mr Mbeki had abused his position to compromise the criminal justice system by blocking some investigations into corrupt practices, City Press reported.
Mr Mbeki's spokesperson Mukhoni Ratshitanga said the allegations were libellous and malicious, and a letter had been sent to Mr Zuma's office to seek clarity about Mr Heath's comments.
Mr Radebe said he had discussed the controversy with Mr Heath at Mr Zuma's request, and he had agreed to resign.
"The manner in which events unfolded following his appointment, created a perception, rightly or wrongly, that he would not be in a position to execute his duties in an independent manner as expected or required of an incumbent holding that position," Mr Radebe said.
Mr Heath's forced resignation will further damage Mr Zuma's credibility, analysts say.
On 1 December, a court invalidated his appointment of former justice department official Menzi Simelane as chief prosecutor - another key post in the fight against corruption and crime.
The court said there were unresolved questions about Mr Simelane's integrity, as he had once given "untruthful" evidence.
Analysts say there is growing concern that corruption and crime are becoming endemic in South Africa and recent measures by Mr Zuma - including the dismissal of government ministers and the appointment of a commission of inquiry into the controversial 1999 $5bn (£3.2bn) arms deal - has not dispelled perceptions that he is soft on corruption.
Mr Zuma's financial adviser, Schabir Shaik, was convicted of taking bribes from a French arms company in 2005.
The National Prosecuting Authority (NPA) dropped similar charges against Mr Zuma in 2009, citing political interference in the case.
Earlier, he was acquitted of raping a female friend.
Mr Zuma said he had been a victim of a "political conspiracy".