Johannesburg: South Africa’s government on Tuesday sought to play down fears of anti-immigrant violence in impoverished townships, saying recent looting of foreign-owned shops was “pure criminal activities”.

As looting continued for a second night, the violence forced foreigners to flee and raised fears of a repeat of xenophobic attacks that killed 62 people in 2008.

Some 54 people were detained over two days over the unrest, police said.

“The government has noted with concern so-called xenophobic attacks on foreign nationals in townships” around Johannesburg, spokeswoman Phumla Williams said in a statement.

“We strongly condemn violence not only on foreign nationals but also on South Africans,” Williams said.

She called the recent unrest “pure criminal activities” and stressed that “South Africa is a democratic country that accommodates foreign nationals that are in this country legally”.

Looters in Diepsloot, a volatile township north of Johannesburg, went on a rampage on Sunday after a Somali shop-owner allegedly shot dead two people.

The trader told police he had opened fire as the two people tried to rob him.

On Monday morning armoured police vehicles were mobilised in the township to guard large foreign-owned shops after one was set on fire during overnight looting.

Amid widespread poverty and unemployment, frustration in South Africa’s run-down neighbourhoods often boils over into anti-immigrant violence.

Immigrants in other Johannesburg townships also suffered attacks last week after protests over poor service delivery turned into violent looting.