A teacher was hacked to death with a machete in front of a shocked classroom of primary school students in South Africa, media reports said on Thursday.

Guilford Shapo, 53, was killed Tuesday at Masehlong Primary School in the northern town of Polokwane, where he was observing seventh-grade students taking an exam, SABC public radio reported.

His 40-year-old brother, who has not been named, has been charged in the case, it said.

"We were alerted by the pupils as they screamed and ran out of the mobile classroom," principal Noko Moabelo told The Star newspaper.

"Mr Shapo was the only male teacher at the school. As women, none of us could take the risk of approaching the suspect," she said.

Neighbours heard the screams and dashed to the school, where they restrained the man as he was still hacking at his brother's body, the paper added.

Violence plagues many of South Africa's schools. A 46-year-old high school teacher was arrested Wednesday outside Johannesburg on charges of raping 11 students, police said.

A survey of South African school boards released in July found that 29 percent believed sexual harassment by teachers was a top problem in their classrooms.

The latest police statistics show that South Africa's murder rate is at the lowest level since the end of white-minority rule in 1994, but it remains among the highest in the world with nearly 43 killings a day.