JOHANNESBURG – South Africa's government on Thursday threatened to crack down on violent protests which erupted this week over jobs and living conditions, posing an early challenge to President Jacob Zuma.

Police fired rubber bullets and teargas on Wednesday at township rioters who were calling for the removal of local officials of the ruling ANC party they accuse of corruption. Scores of protesters have been arrested.

Handling the crisis will be an early test for Zuma, who took office in May after pledging to do more to help the poor. That main plank of the ANC's election manifesto has been constrained by financial woes in Africa's biggest economy.

The law must take its course. We'll deal ruthlessly with that because we can't allow that. We're not going to allow anyone attaining their goals by illegal means, Cooperative Governance Minister Sicelo Shiceka said on Talk Radio 702.

Police said calm had returned to Siyathemba township, southeast of Johannesburg, after four days of rebellion. Violence flared in various townships after a series of strikes.

The unrest, with scenes reminiscent of attacks against foreigners last year that killed 62 people, have dented South Africa's hope of showing a positive image less than a year before the country hosts the soccer World Cup.

In the Ramaphosa squatter settlement east of Johannesburg, one of the main trouble spots during last year's violence, thousands of residents staged a peaceful protest march.

Watched by heavily armed police, the protesters carried placards. One said: Poor service delivery is what we hate.

Many South Africans say local governments have failed to provide jobs, housing, sanitation and medical services, and have instead promoted a culture of nepotism.

I want to live like Zuma in a house with electricity. I'm tired of living in a shack, I want a flush toilet, said Nicolas Mabitsela, who lives in the Ramaphosa settlement.

RECESSION

Tough police measures could further alienate residents of grim townships, glaring reminders of decades of apartheid when angry youths also burned tires and hurled stones at police.

A crackdown could also risk creating the perception of instability and make foreign investors uneasy.

I don't think a clamp down on that (the protests) is going to be the solution, they have to look to protect property, they have to look to ensure that law and order is maintained, said Eurasia Group analyst Mike Davies.

The government is limited by South Africa's first recession in 17 years, a result of the global crisis, and is wary of any policies that might discourage local or foreign investment.

It also has to contend with trade unions, whose support was instrumental in Zuma's rise to power, staging stoppages over pay and threatening further action.

Zuma's spokesman Vincent Magwenya said South Africa's leader believed there was no justification for violence.

While residents may have genuine grievances, the president's view is that there can be no excuse for violence or destruction of property, Magwenya said on Talk Radio 702.

In an opinion piece in South Africa's Business Day newspaper, Richard Pithouse, who teaches politics at Rhodes University, accused authorities of taking the problem lightly.

Government statements about the virtues of law and order, empty rhetoric about its willingness to engage, and threats to ensure zero tolerance of anarchy only compound the distance between the state and the faction of its people engaged in open rebellion, he said.

(Additional reporting by Tiisetso Motsoeneng and Alison Raymond; editing by Robin Pomeroy)