The government in Pretoria has been trying to find a solution which means they wouldn't be obliged to arrest Vladimir Putin, if he arrived in the country.
Vladimir Putin has agreed not to attend an economic summit in Johannesburg next month after being asked to stay away by host country South Africa.
A major legal quandary faced Pretoria over whether to arrest the Russian president who is subject to an International Criminal Court warrant.
The August summit brings together Brazil, Russia, India, China and South Africa — a bloc of developing economies known as BRICS.
Officials have said Putin wanted to attend the gathering, though they tried to persuade him to stay away to avoid the legal and diplomatic fallout over his international arrest warrant.
On Wednesday, the office of South African President Cyril Ramaphosa said Putin will not attend the BRICS summit after a “mutual agreement," ending months of speculation.
South Africa is a signatory to the Rome Statute that established the ICC and would have been obliged to arrest him.
Although Moscow has dismissed the warrant and Russia doesn't recognise the authority of the ICC, Putin has not travelled to any country that is a signatory to its treaty, since he was indicted by the international court in March for war crimes relating to the abduction of children from Ukraine.
South African authorities had given strong hints that they would have likely not executed the arrest warrant against Putin.
But South Africa's main opposition party has taken the government to court in an attempt to compel it to arrest the Russian leader if he sets foot on their territory.
Russia will be represented at the BRICS summit by Foreign Minister Sergey Lavrov, Ramaphosa's office said in a statement.
All the leaders of the other four countries, including China's Xi Jinping, will attend, it said.
Ramaphosa has said that any attempt to arrest Putin would have serious consequences for South Africa, including it being viewed by Russia as a “declaration of war.”