Police on Wednesday evacuated students from a Hamburg school in Hamburg over a "threat" as German media reported that two students had allegedly threatened a teacher with a pistol in class.

"There are currently indications of a threat situation at the Blankenese high school. Police forces are already there and carrying out the first measures," said Hamburg police on X, formerly known as Twitter.

Police did not specify the source of the danger, but Bild daily reported that two students had threatened a teacher in a classroom, with one pulling out a pistol.

Officers have entered the building and students were being led out.

Parents have been asked to head to a nearby barracks where the students have been brought.

The area surrounding the school has been blocked off.