More than 500 pupils in South Africa stoned to death two robbers who were part of a gang that had attacked their school armed with guns.

Four robbers attacked the Zwelihle School in South Africa's KwaZulu-Natal Province.

The robbers successfully entered the school despite the presence of a security guard and held two classes at gunpoint.

Students said that while one of the robbers pointed a gun at them, the others went through their belongings, looking for cash and mobile phones.

"We know these guys. They bully the schoolchildren all the time and steal their money and other valuables. They are known to attack pupils inside the school too," a girl pupil said.

Things took an unlikely turn after some of the pupils asked the criminals if their guns were working.

Panicking the gang of four fled and ran away but was quickly pursued by the students, aged between 12-14.

"They started running. This did not stop us. Everyone gave chase. We were all sick and tired of their bad habits", she continued.

"Some of the pupils eventually caught them at the settlement. They started hitting them and pelting them with stones. More than 500 children were there", she added.

As a result of the pupil-led attack two of the robbers were killed and another was left in critical conditions while the fourth criminal escaped.

"These suspects were about 15 years old. They did not go to school. Someone alerted the police who arrived a few minutes later. But, by that time it was too late. Two of the suspects had died, a third is in a serious condition and the fourth guy ran away" the girl said.

Police said the students would be interrogated but confirmed that no arrest have be made, according to South African press reports.

Students defended their action. "We are very happy they are dead. At least now they won't worry anyone. It is also a warning to other robbers. We are not afraid of guns. They will feel fire if they rob us again. We are sick and tired of being terrorised by criminals and bullies in the area." one said.