PARIS -- A 16-year-old student who had problematic relations with his peers opened fire at a high school in southern France on Thursday, wounding at least two other students and the principal who tried to intervene, officials said.

Police moved into the Alexis de Tocqueville school in the town of Grasse -- the country’s picturesque perfume capital -- and quickly arrested the still-armed suspect, identified by the Interior Ministry spokesman as Killian Barbey.

The Grasse prosecutor said there were a total of 10 victims, three of them suffering from “emotional shock.” None of the injuries was considered life threatening.

Get Breaking News Delivered to Your Inbox

Prosecutor Fabienne Atzori said the young man -- armed with a rifle, several pistols and a small grenade -- entered a classroom then left, “not finding the person or people he was searching for.”

“The motivation of the student appears linked to bad relations with other students in this high school in which it appears he had some difficulty integrating,” Atzori said.

She said there was no reason to suspect the shootings were terrorism-related, “whatever the origin of the terrorist enterprise.” A national police official said earlier there did not appear to be any other suspects.

This illustration picture taken in Rennes, France, March 16, 2017, shows the screen of a smartphone displaying a French government attack alert relating to a shooting at a high school in the southern French town of Grasse. Getty

Officials variously gave 16 and 17 as the age of the suspect. His Facebook page indicates he is 16.

After the suspect started shooting, students alerted the principle, who was wounded while “courageously” intervening, the prosecutor said. Some students only discovered shrapnel in their bodies once home, she said.

Education Minister Najat Vallaud-Belkacem, who visited the school Thursday, called it “the crazy act of a fragile young man fascinated by firearms ... We just missed the worst.”

The suspect’s Facebook is filled with violent or gory images.

During the attack, some students hid at the school and others were evacuated. A police helicopter circled overhead in what is normally a relatively quiet corner of France.

School children, wrapped in blankets, wait nearby their high school in Grasse, southern France, after a 16-year-old student opened fire, wounding two other students and the principal trying to intervene, Thu., March 16, 2017. French Education Minister Najat Vallaud-Belkacem says the shooting in a high school appears to be the “insane act of a fragile young man fascinated by weapons.” AP

Police cordoned off the area and worried residents gathered outside in the town, which is 25 miles from the southern city of Nice, site of last year’s Bastille Day terror attack that killed 86 people.

The president of the region, Christian Estrosi, said the principal suffered an arm wound and told him that after being alerted to the presence of the armed student, “he tried to interpose ... to try to calm him, and unfortunately he didn’t succeed.”

A visibly shaken student told BFM TV that he heard four shots, then “it was total panic” at his school.

“I was downstairs ... We started to run. I was with a buddy and we took refuge upstairs,” said the young man, identified only as Andreas. “Then, the riot police arrived ... It was like in a film.”

“We hear this kind of thing in Paris. Now we understand what it is,” he said.

A woman holds a rose after an attack in a high school in Grasse, southern France, Thu., March 16, 2017. A French high school principal and two others were shot Thursday at their school in southern France, and a 16-year-old student suspected of opening fire on them was arrested in a police raid, officials said. AP

While no terrorism link has been identified, “All this justifies the state of emergency,” President Francois Hollande said, adding that it would remain in place until July 15, as planned.

An employee of a nearby electronics store said police had asked residents to stay indoors. An employee of sports chain Decathlon, which has a branch less than 500 meters from the high school, said he’d seen about 40 high school students leaving and gathering in a nearby parking lot.

Both local residents would not provide their names.

The government sent out an alert warning of an attack after police reported that shots were fired, but later lifted it. The alert is part of a system implemented by the government after the deadly November 2015 attacks in Paris.