Police have fired rubber bullets and tear gas outside a court in South Africa as protests erupted after charges related to a cannibalism case were withdrawn.

Seven men accused of cannibalism appeared at the Estcourt Magistrate's Court on Thursday 12 October. They face charges ranging from murder to conspiracy to commit murder.

State prosecutor Israel Zuma said that, as per a directive from the KwaZulu-Natal director of public prosecutions, charges against three defendants would be temporarily withdrawn pending further investigation, local news site Estcourt News reported.

The three were released, while the remaining accused were remanded in custody. A bail hearing was set for 27 October.

A crowd that had gathered outside started chanting and hurling bins upon hearing that the charges were withdrawn, according to Times Live.

The news site added that the accused were heard saying "we will eat you" to the crowd as they waited inside police vans before entering the court.

In August, one of the accused, Nino Mbatha, reportedly entered a police station and said he was tired of eating human flesh. He produced body parts as evidence that he was a cannibal.

At the time, police arrested three men accused of having allegedly raped and killed a woman, cutting her into pieces and eating parts of her body.

Police Spokesperson Colonel Thembeka Mbhele said one of those arrested was thought to be a "nyanga", a traditional healer.

Mbatha is among the accused still in custody.

The case rocked the KwaZulu-Natal province and allegedly prompted other people to come forward and confess to eating human flesh, News 24 reported.