Updated

Hundreds of terrified immigrants fled South Africa on Thursday from a wave of anti-foreigner violence that has killed at least 42 people and shredded the nation's reputation for economic and political stability.

South Africans are struggling to buy food as prices rise amid stubbornly high unemployment, and many complain the government hasn't worked fast enough to build houses, schools and hospitals for the black majority. Foreigners were attacked because they are seen as competing for scarce resources — and because they were the closest targets at hand for the poor.

Even as the army sent soldiers into the streets for the first time since the end of apartheid rule to quell the violence, immigrants crammed onto buses bound for Mozambique and elsewhere. They hurriedly passed bags — and sometimes even babies — through the windows of departing buses.

Government officials said they were working with international aid agencies to help repatriate terrified foreigners, whom South Africans blame for crime and unemployment. More than 25,000 foreigners have fled their homes since the attacks began.

Many Zimbabweans — their own country mired in political and economic turmoil — said they had nowhere to run.

"It's scary. I think maybe they will come back to attack me," said Dzidzah Masiiwa, a Zimbabwean painter, who had spent three nights in the relative sanctuary of a police station in the poor Johannesburg township of Alexandra, where the violence started on May 11.

He relucantly returned to his shack Wednesday but didn't feel safe. At least 42 people have been killed, either burnt alive, stabbed, shot or beaten to death. Images of the violence have made front pages around the world and deeply embarrassed the government, whose own leaders sought refuge in neighboring countries during white racist rule.

Two burned bodies were found Thursday in a slum outside Johannesburg, according to an Associated Press photographer at the scene. Mobs set shacks alight at the settlement in the East Rand. Incidents of anti-foreigner violence continued to be reported in other parts of the country, including northern provinces near the borders with Mozambique and Zimbabwe.

Gold company DRD Gold said that production in one of its big mines just outside Johannesburg had suffered because of the attacks.

Spokesman James Duncan said foreigners comprised 33 percent of the work force at the ERPM operation in Primrose in the East Rand, where some of the worst violence occurred at the weekend. As a result, the mine was in a "loss making situation."

"Fourteen percent were absent from work on Monday and (this) deteriorated to 60 percent on Wednesday," Duncan said in a statement. On Thursday, 58 percent of the day shift did not turn up.

"The longer the violence continues, the more profound (the) impact on production will be," he said.

Two of the mine's employees died in the violence, the company said. It appealed to employees who had sought refuge at police stations and elsewhere to come forward for assistance. It said it was holding meetings with union officials, workers and the Mozambique consulate to try to resolve the crisis.

Business leaders visited Alexandra and pledged their support for victims. Security Minister Charles Nqakula was also due to hold a meeting with his crisis task team in the face of mounting accusations that the government did too little too late.

President Thabo Mbeki finally gave the order late Wednesday to call in the South African National Defense Force — for the first time since the end of apartheid in 1994.

Police, backed up by infantry battalion soldiers, made early morning swoops on three slums in downtown Johannesburg which was the scene of some of the worst attacks at the weekend. They made 28 arrests, and seized drugs, firearms and stolen property, said police spokeswoman Sally de Beer.

She said the cordon-and-search operations were conducted at three hostels whose residents were allegedly involved in inciting violence. She said it was "extremely successful." She said there were no "incidents of violence during the operation."

Zimbabwe's opposition leader Morgan Tsvangirai toured some of the worst affected areas to offer solace to his compatriots, who have born the brunt of the violence. More than 3 million Zimbabweans are believed to be in South Africa, fleeing the meltdown in their own country.

Tsvangirai was greeted with cheers outside Alexandra police station when he said he would return home Saturday despite fears of a possible assassination attempt.

Tsvangirai faces a runoff election against President Robert Mugabe Jun. 27. He won the first round of voting at the end of March but not by an absolute majority, but has spent most of the time since then outside the country. He planned to return to Zimbabwe last Saturday but delayed this after his Movement for Democratic Change said there was an assassination plot.

Tsvangirai told the crowd that Zimbabwe's crisis had spilled over into South Africa.

"I am hoping that we are able to solve our crisis back home," he said.

The International Organization for Migration said it was working with the South African government to try to repatriate people who wanted to return home. Spokesman Nde Ndifonka said the organization wanted to ensure that all returns were voluntary and that people received some form of assistance when they got home.

Siobhan Mccarthy, Home Affairs spokeswoman, said the department was scrambling to help foreigners who had lost documentation in the turmoil. The department has tried to reassure illegal immigrants that they will not be deported against their will.