The man carried a knife ladder in his pocket during an exercise at Valsätraskolan, where the staff were to train on lockdown in the event of a violent act.
The school's cleaning staff had not been informed about the exercise, writes Upsala Nya Tidning, and alerted the police, who arrived with several patrols.
Principal Tomas Rylander tells the newspaper that it was a mistake on the part of the school management not to inform all staff.
We should have been clear in our information to the cleaning staff and then the whole thing would not have happened.
He says that the police operation could quickly be concluded. Since it was a study day, there were no students at the school.