Soldiers have been deployed to volatile areas in Johannesburg and KwaZulu-Natal in a bid to quell anti-immigrant violence that has killed at least seven people in several weeks of unrest, Nosiviwe Mapisa-Nqakula, South Africa's defence minister, has said.



The government had vowed to crack down strongly on the unrest, but the decision to put soldiers on the streets on Tuesday came after two nights of relative quiet in both cities.

"We come in as the last resort, the army will serve as a deterrent against the crime that we see," Mapisa-Nqakula told reporters, declining to give details on how many troops would be involved.



"There are people who will be critical but those who are vulnerable will appreciate this decision," she said.



"Now we [are] deploying because there is an emergency."

Mapisa-Nqakula made the announcement in Alexandra, a Johannesburg township where a Zimbabwean couple survived a shooting overnight.



The man and woman were both shot in their necks and the woman suffered an additional shot in her leg, the minister said. Both Zimbabweans were treated and discharged from hospital, the Associated Press news agency reported without mentioning the couple's names.



In the same Alexandra area, a Mozambican man was stabbed to death by four South African men over the weekend. Photographs of the stabbing were published in a local newspaper on Sunday.



The four South African men appeared in court on Tuesday and remain in police custody, said Velekhaya Mgobhozi, the National Prosecuting Authority spokesman.



'Support' to police

Police have struggled to contain mobs who have been attacking foreigners from Zimbabwe, Malawi, Mozambique and other African countries in both the economic capital Johannesburg and in the port city of Durban.



"We are not here to take over the work of the police. We are simply here to give support to what the police are trying to do in their efforts to prevent a continuation with what we have seen," Mapisa-Nqakula said.

RELATED: Zimbabweans leave South Africa after xenophobic attacks

The spate of attacks has revived memories of xenophobic bloodshed in 2008, when 62 people were killed in Johannesburg's townships, shaking South Africa's post-apartheid image as a "rainbow nation" of different ethnic groups.



Defence analyst Helmoed Heitman, based in Pretoria, told Al Jazeera the decision to send troops to troubled spots showed that the government was concerned.



"While it has been terrible, it has not been a total disaster and I think the decision to deploy is an attempt to prevent a disaster from taking place," Heitman said.



South Africa has been criticised by foreign governments, including China, Nigeria, and Zimbabwe, for failing to protect foreigners as TV stations broadcast images around the world of armed mobs looting immigrant-owned shops.



President Jacob Zuma's government was put under further pressure when images appeared in local media on Sunday of men beating and stabbing Mozambican Emmanuel Sithole to death in broad daylight.