A Pew Research Centre poll conducted in 2018 showed that over 60 percent of South Africans viewed immigrants as a burden on society by taking jobs and social benefits, and that they were more responsible for crime than other groups.
Between 2010 and 2017 the immigrant community increased from two million people to over four million, and that figure has climbed by at least another million since.
The proportion of South Africa's total population that is foreign-born increased from 2.8 percent in 2005 to seven percent in 2019, according to the United Nations International Organization for Migration, in spite of widespread xenophobia.
This made South Africa the largest recipient of immigrants on the African continent.
These facts, and the subjective perceptions that go with them, lie at the heart of the sporadic episodes of xenophobia in South Africa (SA) over the last three decades.
The lived experience of South Africans, especially in urban centres where foreign migrants tend to settle, is that proportionally, many more foreign-born Africans are now among them and are interacted with daily.
Most of the time, micro-enterprises run by foreigners from tiny stalls, roadside locations and sometimes in recycled shipping containers are accepted by the local communities they service.
Most often on sale are small quantities of fresh vegetables and fruit, some of them sourced from small-time township growers, local and foreign, or low-cost clothing items obtained from mass imports mainly from China.
Beyond the streets where these imported items are sold, they have caused problems for larger apparel and garment suppliers, as well as for SA's domestic textiles industry hit hard by imports whose landed price is lower than the output costs of domestic equivalents.
But the macro-economic issues involved are meaningless to people who live on these high-density, low-income streets where foreign traders mostly operate – the point is that these roadside goods cost less than exactly the same thing in formal shops.
Competing on the fringes, with a minimal revenue stream, is the order of the day for almost all such foreigners who have come to SA as political, economic and, increasingly, climate change-driven migrants.
It is a hard and uncertain life, given that most are undocumented, leaving them vulnerable to official harassment and extortion.
Despite this, and the time-to-time disaster of yet another xenophobic spasm that always looms over them, most foreigners living and working in SA prefer their current circumstances to 'going home', which for many is not a practical option.
Above all things, most of those we interviewed fear being deported back into the intolerable and unlivable conditions from which they fled.
An example is found among citizens of the Democratic Republic of Congo (DRC), thousands of whom live in urban centres.
Given their language problems, many have ended up in menial jobs, such as 'car guards' at shopping centres, receiving tips as pay.
Most of them hail from eastern DRC, where numerous rival militias, some apparently backed by either Ugandan or Rwandan interests, have made normal life all but impossible.
Asked if they would go back, some said they would prefer to be imprisoned in SA, where at least they would have a bed and something to eat.
Similar sentiments are expressed by Zimbabweans and those from conflict-ridden zones elsewhere.
Some have come from other major African urban centres, but they too do not want to return to their homelands, if they can avoid it.
Peter, who said he was a "captain in the army" in his homeland of DRC, is an educated man in his early 40s. He said outside a Cape Town eatery where he was 'guarding’ the cars of diners, that he had left his country and his seemingly well-paying job because of violence.
His people come from southern DRC, around Katanga, where contention over valuable mineral resources continues at a low level, a situation that began in the 1960s.
Despite his 'fall' in social status and income, Peter says he is much happier in SA and has set himself the task of becoming not merely fluent but excellent in English, which he did not speak at all when he arrived several years before.
"I want to become so fluent that I can do almost any job. As soon as I can, I will register (at university for a correspondence course) to get a degree. I do not want to go back – no matter the problems of South Africa, it is still a much better place than my homeland."
Asked about his family, Peter's broad smile disappears.
He is silent for a moment, shakes his head with a glint of tears evident in the corner of his eyes, and says: "I cannot talk about that."
The issue is obviously too painful to discuss in the street with an inquisitive reporter.
The similarities of the difficult journeys undertaken by foreigners, merely to arrive in SA, are striking, as is the determination to make a new life.
Leonard John, 47, is luckier than most migrants. He had some schooling in Malawi, speaks good English and landed a job as a caretaker of a property used by several professionals working out of a suburban home developed into a mini medical practitioners' centre.
He is happy living in Cape Town, where xenophobia exists but at a lower level most of the time compared with greater Johannesburg and other areas of the country.
"I came to South Africa in 2005," explains Leonard, speaking outside the wooden shack somewhat more substantial than those usually available to migrants.
"I think of this place as my home now – everything I have is here.”
He lives with his son, Justin, 24, whom he sent for from their home in Blantyre, Malawi, once Leonard had found his feet in SA.
Leonard is teaching his son 'general maintenance' so that he too can have a relatively good livelihood.
Neither has any inclination to return to Malawi.
While Leonard is happy to talk to a reporter, he is wary of having his picture taken and declines to allow it, indicating that he fears "becoming known" in some manner.
Justin is less bothered and is happy to pose for pictures outside what has become his new Cape Town home.
These two migrants are much better off than those forced to live in shantytowns in major cities and even small towns.
In some cases, particular locations have attracted people from specific countries, resulting in much higher concentrations of foreigners from the same country. They live as sub-communities in the midst of South Africans, who occasionally turn on them when xenophobia erupts.
It is a fraught and stressful existence, but they say it is still better than what they escaped.
Violet, 49, from Mutari in Zimbabwe, has lived in SA for three years.
Like many others, she left her family in Zimbabwe and is worried that, even with a change of government back home, her relatives might be endangered if the family name is published.
Sitting beneath her umbrella on the road leading into Capricorn village, her goods laid out in front of her on a portable table draped with a tablecloth, Violet says she is happy with her life in SA and that she has been accepted by the local community.
Capricorn is a relatively new low-income settlement, and has people of all colours and origins living together, offering some hope of a future for foreigners in SA.
In other similar settlements, such as Khayelitsha, about 15km east of Capricorn, where some 2.5 million people live, the number of 'other language' residents had grown exponentially from 0.6 percent in 2011 to 3.8 percent in 2019, with more foreigners settling there since.
The pattern is repeated across the country in established communities, where foreigners, because of language, culture and mutual protection, tend to live in sub-groups clustered together.
"Where I live, I have never had a problem," says Violet when asked about relations with locals.
"You can see for yourself. I sit here every day, and people come past and buy things from me. We have no problems, we are all friends, we are all Africans, even the white people that live here."
The phenomenon of whites living in what were formerly exclusively black shantytowns is a relatively new post-apartheid manifestation of some reshaping of South African society.
Violet and her friends at nearby stalls think that one of the reasons there are few problems in her area is precisely because of the mixed nature of the community. It is a different picture from what prevails in Khayelitsha, a Xhosa name meaning 'new home', where still around 90 percent of residents speak isiXhosa as their mother tongue, and where xenophobic attacks are more likely.
Sheba Dhliwayo, from Harare, has lived in SA for 10 years and was an informal trader in Zimbabwe before being driven out by police as part of Robert Mugabe's Operation Murambatsvina, a Shona word meaning "drive out the rubbish". It began in 2005 and was revisited repeatedly when traders who had been closed down, sometimes brutally, restarted their micro-businesses.
Unable to bear the stress any longer, Sheba, 39, decided to come to SA and do what she had been doing in Harare.
Her wares are strewn atop colourful hanging clothes on part of the pavement near fellow Zimbabwean trader Violet, whom Sheba helped "find a place to live and something to sell" when she came to Cape Town.
They are compatriots and good friends.
Sheba agrees with Violet that living and working in SA is much better than in their homeland, even years after Mugabe's departure, because, she says, "nothing has really changed in Zimbabwe – the government can do anything and it is not safe to live".
Neither has any desire to return to their homeland.
But when the special residence and work visas issued to Zimbabweans by South African authorities expire at the end of 2022 – a decision prompted by growing political pressure to curb economic migration from SA's shambolic northern neighbour – they do not know what they will do.
"We shall have to see what we can do," says Sheba, who exudes personal self-assurance that belies the tenuousness of her situation.
"If necessary, if it must be, then we will stay without papers – like all the other people from other (African) countries living here," she adds, with a shrug of the shoulders for emphasis.
Besides such micro-traders, there are other nationalities and types of migrants who choose more formal trading conditions. This is usually the ubiquitous 'corner shop' found even in wealthy suburbs and at virtually every street corner in places like Capricorn.
These are the sorts of shops, brick-and-mortar constructions, which early immigrants from places like Somalia chose as a means of living in SA. They were heavily targeted in the extreme xenophobic wave that swept through SA in 2008, leaving scores dead.
One such shop, in the heart of Capricorn, whose owner has not bothered to paint a name on its exterior, is still run by Somalis, though none wished to talk on the record.
The shop has notably intense security, like most small shops in shantytowns around the larger centres. It has heavy grills protecting goods and the sellers, with money and goods exchanged through a small opening that allows in little light and offers a scant sense of what may be for sale.
The seller is also a foreigner. A local steps up to the tiny opening and buys a face mask, still required for travel on public transport or to enter shopping malls. The buyer expresses surprise that the price has dropped a little – a sign that some of the extremes of the Covid-19 pandemic, like requiring masks that were initially hard to find and expensive, are receding here at least.
The seller does not want to talk but allows a picture of the outside of the shop to be taken.
Has there been any 'trouble', the seller is asked, to which he shakes his head indicating not.
Around the corner, a local gangster, clearly declaring himself as such by his many necklaces hung around his neck and his smooth style in 'gangster-chic', is happy to chat, though not on the record by name, and with no pictures.
"Ya," he says, when asked whether there are any issues like xenophobia or gangsters using such to attack 'corner shops' of the type he is standing outside, "sometimes in the past there were problems, but we have made it safe here – foreigners do not have to worry".
That is as close to an insurance policy as foreigners living and working in this community are likely ever to get – to the effect that they and their businesses are not in danger merely because they are foreign-born.
In such townships, the reality is that the police, sometimes assisted by the army, can come and go, but the gangs will remain, along with the violently competitive and complex relationships they have with each other.
While one gang's turf may be safe for foreigners, which of another in a different area may well not be.
The state has little say in how these communities deal with their problems, faith in the police being low, as demonstrated recently when police minister Bheki Cele visited Khayelitsha, in south-east Cape Town, after two more recent incidents of mass killings, including one claiming five lives.
Even as the minister was speaking to community members, another murder occurred not far from where he stood.
Cele promised to do more to rein in the runaway violence in Khayelitsha and other areas, such as Mannenburg, where eight people were killed in a single gang-related mass shooting the previous week.
This violence is accepted by foreigners as simply part of the threat they must live with, if they are to stay in SA and continue making a living.
But for some, such as electronics and cellphone repair shop owner Eric, from Cameroon, who has lived in SA for almost 20 years and is married to a local, there is relative safety, and near complete integration into the community.
"My wife," says Eric, pointing over his shoulder towards her in their open-fronted repair shop, "is from here."
"My kids are locals, and I have become one."
His friend, sitting beside him and also from Cameroon, agrees that it is safe for foreigners to live in SA, at least this particular part of it.
But he does not want his name used and when Eric agrees to have a photograph of him and his shop taken, his wife steps forward and, with a few quiet words, that option is closed. She does not want to take unnecessary risks speaking to an unknown journalist, a slightly abashed Eric explains.
"We are OK. But everyone knows that there has been trouble and 'the boss' says it is stupid to allow pictures."
He ends the interview with a broad grin and a thumbs up – a small victory against the rising and falling tides of xenophobia in SA, still the 'land of hope' for many Africans living in less blessed lands across the continent.