A Pakistani teacher accidentally shot a 12-year-old pupil while cleaning his pistol, leaving the child dead on the spot.

"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 said Fazl Rabi according to the Agence France Presse.

The teacher has been arrested, said the Saleem Khan Marwat, the area police chief, AFP reported.

The incident happened on the outskirts of Mingora, which is around 180 kilometers northeast of Peshawar.

The Northwestern Khyber Pakhtunkhwa province allowed teachers to carry firearms after the massacre of 132 students by Taliban militants last year. Teachers were trained to use firearms for defense since police guards couldn't be provided for every school.

The teachers' associations objected to arming the staff, claiming that it isn't their responsibility to fight off militants. However, it seems that the teachers didn't have a choice.

The move was aimed at increasing security in schools after the Peshawar massacre, which was the deadliest terror attack in the city's history, Outlook India reported.