South Africa says it will pull out its troops from the Central African Republic (CAR) after rebels there seized power more than a week ago.
President Jacob Zuma said a deal between the countries had become void with the ousting of Francois Bozize.
Mr Zuma was facing anger after 13 South African soldiers died in the rebellion.
He announced the withdrawal at an emergency regional summit on CAR, during which African heads of state refused to recognise the rebel leader.
Michel Djotodia declared on 25 March that he would rule by decree after his Seleka rebel group stormed CAR's capital, Bangui, ending President Bozize's decade-long rule.
The rebel leader said he would run the country until elections in 2016.
"It seems impossible to us to recognise a man who has appointed himself," said Chadian President Idriss Deby following the emergency summit hosted in Chad's capital, N'Djamena.
He said Mr Zuma had informed regional leaders he planned to withdraw withdraw his forces from CAR.
South Africa has about 200 troops stationed in the capital, Bangui, to block the Seleka rebels from overthrowing the government of Mr Bozize - who is now in Cameroon.
As well as the 13 dead, another 27 soldiers were injured - the highest number of casualties suffered by South Africa's army since white minority rule ended in 1994.
The deaths caused controversy, with critics saying the troops had been deployed to protect South Africa's mining interests in CAR. President Zuma's governing ANC party rejected the claims, saying the soldiers were training government forces and providing security.
Speaking on Thursday, Mr Zuma said South Africa's deal with CAR was no longer valid.
"We were in CAR on the basis of the agreement between the two countries. Our mission was to help train the soldiers," he told South African broadcaster SABC.
"Since the coup and the self-appointment of rebels, it was clear that the government is no longer there."
President Zuma said regional heads of state at the summit made it clear they would reject anyone seizing control by force.
"The position of the African Union is that no regime will be recognised in this continent if they take over unconstitutionally, by using military to overthrow the government."
South Africa's main opposition leader, Helen Zillen welcomed the military withdrawal but said her Democratic Alliance party still demanded "a full explanation of why South African troops were deployed in CAR in the first place".
She had earlier said that the mission "was reportedly undertaken against expert military advice" and was "allegedly to protect the business interests of a politically connected elite, both in South Africa and the Central African Republic".
A memorial service for the 13 killed soldiers was held in the South African capital, Pretoria, on Tuesday.