President Cyril Ramaphosa has called for a peaceful and just resolution to the tensions between Iran and the US.
The Iranian Presidency revealed in a statement on Thursday Ramaphosa had spoken with his Iranian counterpart during a phone call.
"President Ramaphosa's engagement with President [Hassan] Rouhani was informed by South Africa's principled view that conflicts should be resolved through political dialogue rather than the use of force," South African Presidency spokesperson Khusela Diko said in a statement on Friday.
"The engagement was also framed by South Africa's role as a non-permanent member of the United Nations Security Council and incoming chair of the African Union," she added.
Tensions in the Middle East soared after American forces assassinated a top Iranian military commander, Qassem Soleimani, who was believed to be responsible for various attacks on US military bases and facilities over the years, News24 reported.
In the phone call with Ramaphosa, Rouhani said he was determined to prevent tension and insecurity in the region, the Iranian Presidency statement said.
"We are determined to prevent tension and insecurity in the region, and we hope the Americans stop their incorrect actions. Of course, they know that if they take another action against our interests, they will face more serious reactions."
Rouhani told Ramaphosa regional issues stemmed from the US' illegal sanctions.
"We hope all friendly countries take appropriate stances towards this illegal action and make the US observe the law," he said.
Rouhani added it was important for other countries to take a stance against the unfair assassination of Soleimani.
"We must make the Americans understand that the world will not accept their criminal actions," he explained.
In response, Ramaphosa conveyed to Rouhani South Africa's condolences following Soleimani's assassination last Friday.
"President Ramaphosa also conveyed South Africa's sadness at the loss of life, including that of a significant number of Iranian citizens that resulted from the crash of Ukrainian International Airlines Flight 752 shortly after take-off from Imam Khomeini International Airport in Tehran on Wednesday," Diko said.
In the interest of global peace, Ramaphosa expressed deep concern over the military action by the US and called on all sides to "exercise maximum restraint and conduct themselves within the rule of international law".
He said South Africa was concerned about escalating tension in the Middle East which could have far-reaching implications for the region, international peace and security.
"President Ramaphosa also spoke of the need for all countries of the world to observe United Nations Security Council resolutions and the United Nations Charter.
"The charter calls on all member states to refrain, in their international relations, from the threat or use of force against the territorial integrity or political independence of any state, or in any other manner inconsistent with the purposes of the United Nations," Diko said.