JOHANNESBURG, South Africa (CNN) -- South African police and military units raided three hostels Thursday in a clampdown on xenophobic attacks that have left more than 40 dead, authorities said.
Twenty-eight people were arrested in the "extremely successful" first joint operation, according to a statement from the South African police and South African National Defence Force.
The statement said 150 kilograms (330.6 pounds) of marijuana was seized along with firearms, ammunition and suspected stolen property.
Two of the hostels raided were in Jeppe and the third was in Cleveland, all in the Johannesburg area.
South African President Thabo Mbeki approved the deployment of the army Wednesday to help stop the attacks, which have drawn condemnation from South African officials and other African leaders.
Police said 42 people have been killed in the violence, which began last week in Johannesburg's Alexandra Township and has been concentrated in the city's poorest areas.
Some 28,000 people have been displaced by the violence, Hangwani Malaudzi, a spokesman for the Ministry of Safety and Security said. And more than 400 have been arrested for crimes ranging from murder, to causing a public disturbance, he said.
The country has also seen a disturbing throwback to the 1980s apartheid-era lynching tactic of "necklacing," which was widely used in the townships at the time.
Used on suspected informants, the "necklace" is a car tire, filled with petrol, put around the person's neck and set alight.
The victims are mainly immigrants and refugees from other parts of Africa, including Zimbabwe, where a devastated economy has sent at least two million people across the border in search of a better life.
Some say the attacks stem from a long-standing feeling among locals that the number of immigrants in South Africa results in shortages of jobs and essential needs.
Inadequate housing, a lack of running water and electricity, the rising prices of food, and escalating crime -- nearly 20,000 people were slain in South Africa last year -- add to the resentment. Watch analysis of reasons behind xenophobic attacks »
South Africa's army has been patrolling riot-hit townships to restore calm as the country counts the cost of the xenophobic attacks.
Brigadier General Kwena Mangope of the South African Department of Defense said troops were assisting the South African Police Service, the national police.
"We are in a supporting role," Mangope said. "We are not taking over the operation."
He said the army was providing troops and equipment, such as helicopters and tents.
The deployment of the military and the continued operations of the police service helped quell the violence, Malaudzi said. Community groups, churches, and communication between police and affected communities also helped the situation, he said.
"The message is going out there to say we condemn this kind of action, and (to) those that are involved in instigating this violence, the law is going to come down on them very, very seriously," Malaudzi said.
According to South Africa's latest census, the country has about 45 million people. The South African Department of Human Affairs estimates that more than 4 million people reside in South Africa illegally, but that figure is based on a 10-year-old study and some feel the number of immigrants in South Africa is much higher.
Some say that millions have recently fled to South Africa from Zimbabwe because of violence there since the county's stalled election.
A presidential run-off between long-time leader President Robert Mugabe and his opposition challenger, Morgan Tsvangirai, is scheduled for June 27 in Zimbabwe -- three months after the initial vote.
Zimbabwe also is in the midst of an economic collapse, with nearly 80 percent unemployment.