South Africa's foreign policy dilemma is gone now that Russian President Vladimir Putin will no longer attend the August 22-24 BRICS (Brazil, Russia, India, China and South Africa) summit in Johannesburg.
There had been wide speculation over possible consequences for South Africa if Putin were to jet in for the summit.
The International Criminal Court (ICC) in The Hague has an arrest warrant out for Putin, over alleged responsibility for war crimes committed by Russian forces in the Ukraine war .
Instead, Russian Foreign Minister Sergey Lavrov will travel to South Africa for the summit.
Ramaphosa feared war with Russia
South Africa is a signatory to the Rome Statute that established the ICC in 2002 and under which it issued the warrant for Putin's arrest in March. Thus, South Africa would have had to arrest the Russian president if he had turned up for the BRICS summit.
South African President Cyril Ramaphosa had asked the ICC for an exemption on the grounds that imposing dentention could endanger "security, peace and order of the state."
He also told the court: "It would be inconsistent with our constitution to risk war with Russia."
South Africa and Russia are close allies.
Having Putin in South Africa would have put the country in a difficult position, said Cape Town-based political analyst Daniel Silke.
"There would have been the possibility of complying with the International Criminal Court's arrest warrant, and that would have embarrassed South Africa," he told DW. "Considering the fact that there is a strong bond between the two countries, it was decided from the Russian side not to strain relations that are important for Moscow."
According to Ramaphosa, the decision was mutual.
Putin would have disrupted BRICS agenda
South Africa sees itself as neutral when it comes to Russia's war in Ukraine and is playing a leading role in African mediation efforts.
South Africa's main opposition Democratic Alliance (DA) had put pressure on the government to comply with the ICC and arrest Putin upon entry into the country.
However, according to Silke, it was always unlikely that the Russian president would actually attend the BRICS summit in person. Having him present would have overshadowed the agenda of the emerging economies, which he said also involves finding ways to counterbalance the influence of the West.
"And that's what Russia and China want," Silke told DW. "That's the key to the eventual agreement that was reached."
South Africa risked Western 'wrath'
International pressure, and the ICC warrant, have prevented Putin from venturing beyond outside of Russia: "It has restricted his freedom of movement, and no doubt this will restrict his freedom of movement in many other parts of the world," Silke said.
Political economist Ronak Golpaldas told the Reuters news agency that South Africa will now be able to maintain its position as a government that respects the rule of law. The law, he added, is unequivocal about a country's domestic and international obligations.
He said that South Africa would have had to have arrested Putin when he arrived. "Had that not happened, Pretoria would have been in a lot of trouble — not only in terms of the rule of law, but also in terms of the reaction of the business community and the international community," Golpaldas said.
The impact on financial markets would also likely have been profound, experts say. The South African rand has already been severely weakened in the face of a struggling economy and an unprecedented and protracted energy crisis.
Doudou Sidibe, a professor of international relations at Gustave Eiffel University in Paris, said that if South Africa had refused to arrest Putin, it would have incurred "the wrath or criticism of Western countries."
Vincent Niebede contributed to this report.
Edited by: Benita van Eyssen