Lungisani Magubane (left) and Nino Mbatha (right) face life in prison for the 2017 killing of 24-year-old Zanele Hlatshwayo. [Reuters]

Two South African men accused of cannibalism were given life sentences for murder on Wednesday, with the judge saying they were guilty of "the most heinous crime", local media reported.

Sitting at the Pietermaritzburg High Court, judge Peter Olsen sentenced Nino Mbatha, 33, and Lungisani Magubane, 32, to life in prison for the killing of Zanele Hlatshwayo last year, the Witness newspaper said.

Mbatha, a traditional healer, was arrested after handing himself in at a police station in Estcourt, a town in KwaZulu-Natal province.

He was carrying a bag containing a human leg and a hand, telling officers he was "tired of eating human flesh".

Police refused to believe his claims until he took them to a house where more body parts were found.

A third man was acquitted on Wednesday. Seven people were initially arrested.

At earlier hearings in Estcourt, angry residents had gathered outside the courthouse to protest against the grisly murder.

South Africa has no direct law against cannibalism, but mutilating a corpse and being in possession of human tissue are criminal offences.