Immigrant men armed with machetes make their way onto a Durban, South Africa, street during clashes with police and in search of locals that attacked foreign shop owners in the city center, April 14, 2015 . (AP Photo/Tebogo Letsie)

Over the past week, at least five immigrants have been killed following clashes with xenophobic mobs in the major South African cities of Durban and Johannesburg. Fears of further tensions and violence are growing, with thousands of foreigners seeking shelter at police stations, temporary camps and even a soccer stadium. Others formed machete-wielding vigilante squads, aimed at defending their turf.

South African President Jacob Zuma appealed for a calm in an address to parliament on Thursday.

"The attacks violate all the values that South Africa embodies, especially the respect for human life, human right," he said. "No amount of frustration or anger can justify the attacks."

The initial spark for the mayhem this week, which saw mobs of armed men in Durban attack shops owned by foreigners, is said to be comments made two weeks ago by the Zulu king. Goodwill Zwelithini, whose role is largely symbolic, said at a gathering that foreign migrants in the country were taking South African jobs and that they should "pack their belongings and go."

That fanned the flames in Durban, where Zulus comprise the largest ethnic group, and led to the worst scenes of unrest since January, when looters burned down foreign-owned stores and clashes led to four deaths. In 2008, post-apartheid South Africa saw its worst bout of violence, when anti-immigrant hysteria led to the deaths of more than 60 people, mostly African migrants.

The grim scenes of what amounted pogroms on the streets cast a permanent shadow on the narrative of multi-ethnic and racial harmony associated with Nelson Mandela's "rainbow" nation.

Since then, the problems that fueled that violence have remained, and some would say festered. The country's official jobless rate is at a staggering 25 percent, though experts suggest the real figure is higher. In this climate, foreigners turn into scapegoats.

Estimates vary about the size of South Africa's foreign population, ranging from 2 million to 5 million people in a country of 53 million. They come largely from other countries in the continent -- including nearby Zimbabwe, Zambia, Mozambique, Malawi, Tanzania as well as Ethiopia, Nigeria and elsewhere in sub-Saharan Africa. Bangladeshis and Pakistanis, including many asylum seekers who came in search of sanctuary in South Africa, have also been attacked.

South African police fired rubber bullets and tear gas to disperse a crowd of anti-immigrant protesters in an eastern suburb of Johannesburg. (Reuters)

Critics have accused Zuma's government of being slow to respond to the rising xenophobia, incitement and mob attacks on migrants in the country's cities. They also pointed the finger at the Zulu king for his rhetoric.

"Reckless and inflammatory public statements, such as those made by Zwelithini prior to the Durban violence, should be unambiguously condemned," said a statement from Human Rights Watch. "And those who cross the line into direct incitement to violence against migrants should be prosecuted."

There's a possibility Zwelithini will face hate speech charges.

Xenophobia in multi-racial South Africa is a complex problem, layered over with the country's history of apartheid as well as its peculiar relationship with the rest of the African continent. There are genuine frustrations over the scale of illegal immigration to the country. (A fascinating, in-depth interactive by Al Jazeera goes deeper here.)

And there are many who actively oppose it in the country. The hashtag #xenophobia trended in the country, carrying with it appropriate messages of shame and anger with the conduct of the mobs.

On Thursday, a march of thousands of protesters moved through Durban's streets in solidarity with the city's foreigners, chanting "A United Africa" and "Down with Xenophobia."