Most come from neighbouring countries such as Lesotho, Zimbabwe and Mozambique, which have a history of providing migrant labour to their wealthy neighbour.

Xenophobia has long been an issue in South Africa, which has been accompanied by occasional outbursts of deadly violence, and anti-migrant sentiment has become a key political talking-point.

Judge Leicester Adams, handing down judgment on Tuesday, also barred Operation Dudula from making statements that can be construed as hate speech, “unlawfully evicting foreign nationals from their homes… [or] from their trading stalls” and instigating others to do so.

“Dudula” means to remove something by force in the Zulu language.

The organisation says it is disappointed by the ruling and intends to appeal against it, according to South African online publication News24.