A heavily-armed student was arrested after a shooting at a high school in southern France injured several people including the principal on Thursday, officials said.

Some students hid inside classrooms at the Alexis de Tocqueville high school in Grasse, while others bolted from the campus. Investigators said there were a total of 10 victims, four of whom were shot as others suffered from "emotional shock."

The attack was "the crazy act of a fragile young man fascinated by firearms," according to Education Minister Najat Vallaud-Belkacem, who visited the school Thursday. None of the injuries was considered life threatening.

LETTER BOMB EXPLODES AT IMF OFFICE IN FRANCE, 1 INJURED

The suspect was identified as 16-year-old Killian Barbey, according to a spokesman for France's interior ministry. Police said they had no indications this was an act of terror.

The student was making a series of threats when the principal tried to intervene -- "but unfortunately he didn't succeed," according to Christian Estrosi, president of the regional council that includes Grasse.

The teen carried a rifle, two handguns and two grenades, a police source told Reuters.

DUTCH PM RUTTE CLAIMS WIN OVER 'WRONG KIND OF POPULISM'

"It was total panic," a stunned student, identified as Andreas, told BFM-TV. "I was downstairs ... We started to run. I was with a buddy and we took refuge upstairs. Then, the riot police arrived."

Andreas added, "We hear this kind of thing in Paris. Now we understand what it is."

By the middle of the afternoon, Interior Ministry spokesman Pierre-Henry Brandet said all students at the school were safe. Police initially warned a second suspect may have been on the loose before saying there appeared to be just one shooter, BFM-TV added.

In the aftermath of the shooting, French President Francois Hollande urged the country to stay "vigilant." The attack unfolded the same day a letter bomb exploded at the International Monetary Fund office in Paris, some 500 miles north of Grasse, a hub for the country's perfume industry.

The government sent out an attack alert through its mobile app, warning people in the Grasse area to stay inside, the BBC reported. The alert came in a system implemented by the government after the deadly November 2015 attacks in Paris.

Police closed off the area as dozens of students gathered in a nearby parking lot.

France remains in a state of emergency following the Paris massacre and an attack last year in the city of Nice, which is 25 miles away from Grasse.

The Associated Press contributed to this report.