South Africa's President Jacob Zuma: "There can be no justification for violence"
South Africa's President Jacob Zuma has promised to deliver better services, such as water and housing, in a bid to end township protests this month.
But he warned that there could be no justification for violence.
Mr Zuma also urged understanding from council and other workers threatening to strike for higher wages.
Some 200 people have been arrested in the demonstrations, which revived memories of the deadly xenophobic attacks on foreigners last year.
Fifteen years after the African National Congress won its first election, more than one million South Africans still live in shacks, many without access to electricity or running water.
The ANC has, however, built some 3m homes in that time.
The BBC's Jonah Fisher in Johannesburg says most of the anger has been directed towards local officials and not Mr Zuma, who has only been in power for two months.
His election campaign was based on promises to tackle poverty and unemployment.
During some of this month's protests, police have fired rubber bullets at demonstrators as the riots turned violent.
"Our constitution allows our people the right of freedom of assembly and expression and to protest where they feel they need to, but this must be done within the ambit of the law," Mr Zuma said.
"There can be no justification for violence, looting and destruction of property or attacks on foreign nationals residing in our country," he said.
South Africa announced in June that it was facing its worst recession in 17 years.
People say they were promised housing and electricity years ago
Our correspondent says it is the middle of winter in South Africa - bitterly cold - and job losses mean the recession is really biting as people cannot afford their fuel bills.
It is also the time of year when workers are negotiating next year's pay rises and strikes are being threatened across many sectors, he says.
Recently doctors and workers building stadium for the 2010 football World Cup were on strike.
Some 150,000 council workers have called a strike to start on Monday.
"Due to the current economic conditions, these negotiations may be more difficult this year," Mr Zuma said.
"Employers and workers must negotiate in good faith and should be prepared to understand each other's positions."