Dozens of schools in the Netherlands were closed today and thousands of students stayed at home after an anonymous poster on social media threatened a shooting spree, police said.

Police have detained a former student of the British School in the Netherlands in Leiden on suspicion of making the threat, national broadcaster NOS said.

The poster said he or she intended to "shoot my Dutch teacher and as many students as I can" in a school in Leiden.

"The municipality, police and public prosecutors take the case very seriously. It was decided to close all (local) schools above elementary level," a police statement said. The posting also showed a picture of a pistol.

Officials in Leiden and at the British School could not be reached for comment.