Eight people were injured after a shooting at a high school in the small southern French town of Grasse, the interior ministry said, and a 17-year old student carrying a rifle, handguns and grenades was arrested, police sources said.

"The individual does not seem to be known by police," one source said.

A second source said it appeared that two students had opened fire on the headmaster, who had been injured, adding that the suspects did not seem to be militants.

"One of the two was arrested and the second fled. There was panic and the students took refuge in the (neighboring) supermarket," the source said.

Another police source said it was not yet possible to confirm if there was a second shooter.

Interior ministry spokesman Pierre-Henry Brandet told BFM TV that eight people had been injured, and advised families to remain patient as police took control to stabilize the situation.

The incident comes with France in a state of emergency after several militants attacks over the last year. It is less than six weeks away from a presidential election in which security and fears of terrorism are among key issues.

An student witness in the school interviewed by France Inter radio said the students had heard a bang and taken cover under tables.

"I went to close the windows and saw a guy who looked at me in the eyes. He seemed to be a student and not very big. He shot in the air and ran away," the student said without giving his name.

Local emergency services advised residents on Twitter to stay at home. The government launched its mobile telephone application warning of a "terrorist" attack.