Amnesty International has condemned the escalating attacks against refugees, asylum seekers and migrants, and looting of foreign-owned shops in South Africa.
The global body said the action "is a direct consequence of years of impunity and failures in the criminal justice system that has left this vulnerable group exposed and unprotected".
It also said five people have been confirmed dead "as violence between locals and foreigners continues to escalate in Johannesburg and other parts of the country".
In a statement issued on Wednesday, Amnesty said "South African authorities cannot say that they didn't see this rampant violence coming".
"For many years refugees, asylum seekers and migrants have been targeted for who they are and what they look like. They have also served as convenient scapegoats for unscrupulous politicians who have pushed the insidious narrative that foreign nationals have stolen jobs and are to blame for everything that is going wrong in the country," said Shenilla Mohamed, Executive Director of Amnesty International South Africa.
"The first major outbreak of xenophobic violence witnessed more than 11 years ago which resulted in the killing of more than 60 people, should have been a wake-up call for the authorities to root out hatred against refugees and migrants and hold those responsible to account. Their lack of action has resulted in the subsequent and recurring attacks we've seen."
It also said South Africa has been experiencing systematic looting and burning of businesses belonging to foreign nationals, largely in Pretoria and Johannesburg, for weeks.
"Businesses belonging to Nigerians and other foreign nationals have been targeted in the two cities, with stock and possessions worth millions burnt to ashes," it said.
The agency said the violence dramatically escalated last week following confrontations between locals and foreigners, "marked by horrific attacks and killings".
"The government has largely failed to address past xenophobic, violent outbreaks across the country, instead often continuing to scapegoat foreign nationals for high levels of crime, putting a strain on government services and operating illegal businesses.
"South African authorities must stop fueling xenophobia in their desperate attempt to win political support. Rather, they must build a country that is rooted in respect for human rights and the rule of law that protects everyone," said Shenilla Mohamed.
"South African authorities must come up with a security plan to ensure the safety of all refugees and migrants and seek to end these attacks once and for all. That begins with holding suspected perpetrators of past xenophobic crimes to account and breaking this cycle of impunity," she added.
Amnesty, in its statement also gave a background to the crisis.
"Since 2008 there have been numerous outbreaks of violence against refugees, migrants and asylum seekers in South Africa. In some cases, xenophobia has been fueled by the hate-filled rhetoric of authorities and politicians.
"For example, in December 2016, the Executive Mayor of City of Johannesburg Herman Mashaba labelled foreign nationals living in Johannesburg "criminals" who had hijacked the city. He blamed them for the high levels of crime in the city.
"In November 2018, the then minister of Health, now minister of Home Affairs, Aaron Motsoaledi accused "foreign" nationals of what he called burdening the country's health system."
The xenophobic attacks targeting Nigerians and other nationals in Johannesburg, Pretoria and other cities have left several people dead and businesses and private properties burnt.
South African authorities say they are responding promptly to curb the violence. More than 70 persons have been reportedly taken into custody since Monday.
Nigerians have expressed outrage about the attacks, urging President Muhammadu Buhari to take decisive measures against South Africa.
The president sent an envoy to South Africa on Tuesday for an on-the-ground assessment of the situation.
On Wednesday, Nigeria recalled its Ambassador to South Africa, Kabiru Bala, and also pulled out of the World Economic Summit holding in Cape Town.
Meanwhile, some Nigerians have been attacking South African businesses in Lagos and other Nigerian cities in retaliation to the xenophobic attacks.
The Nigerian government has, however, cautioned its citizens to stop such attacks.