A teacher in Pakistan accidentally shot a 12-year-old student while cleaning his pistol in school on Thursday. The student died on the spot, local police said, according to reports.

The incident took place on the outskirts of Mingora city, around 111 miles northeast of Peshawar. The Northwestern Khyber Pakhtunkhwa province had told teachers to carry weapons to schools after Talibani militants killed 132 students at an army-run school last December in Peshawar.

"Majid Khan, a teacher at the private Sangota Model School was cleaning his pistol in the staff room when it fired a bullet by accident, hitting a student passing through the corridor," local police official Fazl Rabi told Agence France-Presse. Saleem Khan Marwat, the area police chief, reportedly said the teacher was taken into custody.

“I don’t suspect it was intentional," Naseer Khan, head of the local police force, told the Washington Post.

The policy of arming staff has not been well-received by teachers, who say the government had put their security at risk. "Our job is teaching, not carrying a gun. ... This isn't acceptable to us," Malik Khalid Khan, a teacher at a school in Peshawar and president of teachers' union in Khyber Pakhtunkhwa province, told NBC News.

However, authorities have defended the move, saying it is aimed at tightening security at schools. Pakistani security officials have reportedly held training sessions to instruct teachers on storage and handling of firearms.