"We once again unequivocally condemn the maiming and killing of our brothers and sisters from other parts of the continent," the government said. "No amount of frustration or anger can justify these attacks and looting of shops."
Thousands sought refuge in temporary shelters after mobs with machetes attacked immigrants in Durban.
The attacks in Durban killed two immigrants and three South Africans, including a 14-year-old boy, authorities said.
Heavily armed police have scrambled to stop clashes after local residents accused immigrants from other African nations of taking their jobs.
The government praised law enforcement agencies for stopping further bloodshed in Durban.
"We believe that their commitment to duty has prevented injuries and even deaths that could have happened if they security forces had not acted," it said.
'Disgusted with the attacks'
The xenophobic sentiment is certainly not representative of all South Africans.
"There has been an outpouring of support from ordinary South Africans who are disgusted with the attacks not only because they are foreign, or African, but because they are fellow human beings," said Gift of the Givers charity
, which is helping those seeking refuge.
The charity said last week that about 8,500 people had fled to refugee centers or police stations because of the violence.
South Africa's government implored citizens to remember the country's history of overcoming challenges with the support of African neighbors.
"During the Apartheid many South Africans fled persecution and death at the hands of the Apartheid government," it said in its statement. "Africa opened its doors and became a home away from home for many South Africans."
President Jacob Zuma has canceled a trip to Indonesia and visited displaced foreign nationals in Chatsworth to express his support, the government said.
History of anti-immigrant strife
The Gift of the Givers charity assured immigrants that it has a facility in Johannesburg to help those who might need shelter there.
"We have tents and all essential supplies on standby but pray that sanity prevails and this does not become necessary," it said.
In the past, Johannesburg has been the epicenter of anti-immigrant tensions.
In 2008, scores were killed in attacks
in the poorest areas of Johannesburg.
Most of the victims were Zimbabweans who had fled repression and dire economic circumstances. In that attack, police arrested more than 200 people for various crimes including rape, murder, robbery and theft.