A teenage pupil has opened fire at a high school in a small southeastern French town, wounding at least three people, including the headmaster, according to officials.

Five more people were treated for injuries sustained during a stampede after Thursday's shooting at the cafeteria of the Tocqueville high school in Grasse, near Cannes.

The three people with light gunshot injuries were taken to hospital.

READ MORE: Parcel explosion at IMF's Paris office wounds employee

One 17-year-old pupil armed with a rifle, two handguns and two grenades was arrested after the shooting, police said. 

Visiting the scene of the attack, France's Education Minister Najat Vallaud-Belkacem said the shooting was "a crazy act" by an "unstable young man fascinated by firearms".

'Heroic headmaster'

Vallaud-Belkacem saluted the school's headmaster as "heroic".

She said that, "when he saw the pupil taking out his gun, he rushed up to him to reason with him ... and received a bullet injury in the arm."

The Grasse Town Hall said the incident was not "terrorist" related.

"The first investigations suggest that he [arrested teen] had consulted American-style mass killing videos," an interior ministry spokesman said

Schools in Grasse, a town of 50,000 people, were locked down after the incident, and local educational authorities asked parents to stay away.

"Students are safe. Thank you to parents for not coming yet so that security forces can operate," the head of local educational services, Emmanuel Ethis, wrote on Twitter.

 

Al Jazeera's David Chater, reporting from Grasse, said a major police operation was under way across the town.

"There is a sense of shock here," he said. "You can see all the school children sitting by the side of the road, really shocked about what happened.

"We don't know any of the details about what could had been the possible motivation here, but it really has had a terrible effect on this city and the feelings of the students."

Witnesses interviewed by local TV stations described a scene of panic as the gunman entered the school's cafeteria with pupils rushing to hide under tables or sprinting for the exit.

"It was total panic," Achraf, a student, said on BFM TV.

"The gunshots were at four to five metres from where we were. We thought the gunman was coming towards us. We heard him shouting.

"I just know the gunman by sight. He was gentle and low-key key, not a nasty guy."

Another pupil described how he and other students hid from the gunman. 

"We heard a gunshot and then an administrator came out and said 'there's an attack, hurry up and hide'," the student told Al Jazeera.

"We hid in a backroom and barricaded the door with shelving units, then we heard three shots fired. He came along and tried to open the door, but he thought nobody was inside and so he left." 

Source: Al Jazeera and news agencies