The demolition of shacks north of the South African capital Pretoria triggered riots on Monday and overnight in which two security guards were killed, police said on Tuesday.
Four people had been arrested and would be charged with public violence while a fifth faced a charge of murder, police spokesman Tsekiso Mofokeng said.
Poverty, a swelling population and migration from the countryside is aggravating a shortage of urban housing in South Africa, leading to sprawling informal settlements springing up.
“We have intensified our patrols in the area and the situation is under control at the moment,” Mofokeng said.
He said the operation to demolish shacks in the Hammanskraal township, which had been ordered by the local authorities, had been suspended.
The latest flare-up comes ahead of local government elections in August where the ruling African National Congress, which came to power in 1994 when white minority rule fell, is expected to face a tough test especially in urban centres where unemployment and poverty have led to mushrooming shanty-towns.
President Jacob Zuma is also beset with scandals and his opponents are seeking to capitalise on what they see as his economic and political missteps.
(Reporting by Ed Stoddard; Editing by James Macharia and Richard Balmforth)