The South African army will be deployed to end a wave of attacks on foreigners, Defence Minister Nosiviwe Mapisa-Nqakula has said.
Soldiers would be deployed to a township in the main city, Johannesburg, and to flashpoints in KwaZulu-Natal province, she added.
This will be the first troop deployment since the violence broke out early this month, killing at least seven people.
South Africa has faced a backlash from other African states over the attacks.
Many people would “appreciate the decision to bring in the defence force”, Ms Mapisa-Nqakula told journalists.
Troops would not take over the responsibilities of the police but would assist in maintaining order, she added.
The Ministry of Defence said they would be deployed from 18:00 local time (16:00 GMT) in Alexandra township, north of Johannesburg.
Tension has been high in the township since the killing of Mozambican Emmanuel Sithole at the weekend.