It's the photo that has shocked a nation: the stark image of a helpless Mozambican migrant pleading for his life as a gang of men brutally murdered him in a Johannesburg street in front of a silent audience of onlookers.

First the men stalked him along the street. Then one clubbed him with a wrench, while another stabbed him. The Mozambican fell bleeding to the ground and died minutes later, becoming the latest victim in a wave of anti-foreigner attacks sweeping across South Africa.

More than 5,000 migrants, mostly from African nations, have been forced from their homes because of the violence in recent weeks, according to the United Nations refugee agency. Many are sheltering in makeshift camps, while others have boarded buses home to Mozambique, Malawi, Zimbabwe and elsewhere. At least seven people have been killed, and many foreign-owned shops have been looted and razed, as foreigners are blamed for unemployment and other economic and social problems.

Story continues below advertisement

President Jacob Zuma cancelled a trip to Asia on the weekend because of the crisis, while his cabinet ministers vowed that the perpetrators would be arrested. "We will find you and you will be dealt with to the full might of the law," they said in a statement on Sunday, announcing that 307 people had been arrested for public violence since the attacks began.

The story of Emmanuel Sithole, the Mozambican man who was murdered in broad daylight on Saturday while people watched, has galvanized more vows of action. Photos of the murder were published on Sunday in a leading South African newspaper, the Sunday Times, and police promised to use the photos to track down the killers.

Yet history shows that the killers usually walk free. In almost every case of anti-foreigner violence, dating back to 2008 when more than 60 people were killed in an early wave of attacks, nobody has been convicted of the murders. The knowledge of impunity has fuelled the violence, since the attacking mobs are aware that they are likely to escape justice.

A researcher at the African Centre for Migration and Society, based at the University of the Witwatersrand in Johannesburg, estimates that more than 350 people have been killed in so-called "xenophobic" attacks on foreigners in South Africa over the past seven years.

The researcher, Jean Pierre Misago, told the Sunday Times that he could find evidence of only one successful prosecution for any of those hundreds of murders. In most cases, police withdrew the charges or witnesses were too afraid to testify.

In one of the most notorious cases, Mozambican migrant Ernesto Alfabeto Nhamuave was stabbed and set on fire by a mob in a township near Johannesburg in 2008. Photos of his horrific death were published around the world, becoming a symbol of the anti-foreigner attacks. Yet police closed the case in 2010, claiming there were "no witnesses" and the suspects were "unknown."

Earlier this year, South African journalists found witnesses who identified two of the main suspects in the murder, but still nobody has been arrested.

Story continues below advertisement

This impunity is linked to a broader reality: South African authorities rarely prosecute the perpetrators of other routine forms of violence, including vigilante killings of suspected criminals; labour violence by union members; political violence; and anti-government protests in the streets.

Much of this violence was seen as justified during the battles against the apartheid regime, but it has continued for less legitimate purposes after democracy arrived in 1994. By allowing protesters and street mobs to take the law into their own hands for a variety of causes, and by allowing police brutality to continue, the South African government has made it easier for the anti-foreigner violence to gain momentum.