Residents of Zandspruit, north of Johannesburg, pelted police with stones on Thursday during a protest over poor service delivery.
Police officers on the scene, who did not want to be named, said they were trying to break up the crowd when they were attacked.
“We brought in nyalas and water canons and attempted to disperse them, but they turned on us,” an armed officer clad in riot gear said.
“I’m not sure if anyone was injured.”
He said officers used teargas and rubber bullets to prevent the crowd from petrol bombing rubbish they had thrown onto Beyers Naude Drive.
The group was armed with sticks and knobkerries, and sang struggle songs.
Metro police spokesman Superintendent Wayne Minnaar said residents earlier threw stones at passing motorists.
Part of the road in the area was closed for a short while on Thursday morning.
One resident, Precious Ndou said they were upset about inadequate sanitation and poor housing.