South Africa are flying home from the triangular one-day series in Sri Lanka after a fatal bombing in Colombo.
A Sri Lanka policeman guards cricket practice
The decision was made after an independent security review said the team's safety could not be guaranteed following Monday's blast.
South Africa Cricket chief executive Gerald Majola said the risk to the team was at an "unacceptable level".
India, the third team in the series, have decided against cancelling the tour because security has increased.
Seven people were killed in Monday's bombing, about a mile away from where South Africa and India are staying.
Majola added: "The report says there is a real situational threat to the team.
"The Sri Lankan Government is unable to guarantee the physical security of the team given the current security situation in Colombo."
How can a Dubai-based company assess the situation in Colombo?
Sri Lanka Cricket (SLC) officials said they were surprised and disappointed by the decision to pull out.
"South Africa are pulling out of the tournament on the basis of a security company based in Dubai," SLC chief executive Duleep Mendis said.
"How can a Dubai-based company assess the situation in Colombowhen they had not sent anyone to the island to get first-hand information on the current situation?"
Sri Lanka and India will now play three one-day internationals on 18, 20 and 22 August on at the Sinhalese Sports Club in Colombo.
The tournament should have started on Monday but was initially postponed because of wet weather.
The match between South Africa and hosts Sri Lanka was then set to take place on Tuesday but was cancelled pending the security review.
It is not the first time that cricket teams have been caught up in potentially dangerous situations in Sri Lanka.
In 1987 a bomb blast prompted New Zealand to abandon their tour and they again returned home early in 1993 after a suicide bomber killed a Sri Lankan naval officer outside the team's hotel.