France's education minister, Najat Vallaud-Belkacem, lauded the school's "heroic" headmaster, among four people injured in the attack, and who "rushed towards the student to try and reason with him".

Thanks to his actions, "we escaped the worst," she said.

There were calls on Thursday night for the French government to bolster security outside schools with "filter" systems amid questions over how the teenager was able to stroll into the compound with so many arms.

Ms Vallaud-Belkacem described the shooting as "the mad act of a fragile, weapon-obsessed young man". A few days ago he had reportedly sent classmates a morbid picture of students covered in blood on their group Facebook page, but later said it was a joke.

He also posted a Facebook video of himself with a gas and clown mask with a gun to his head.