A 17-year student has been arrested after opening fire in an A-level college in Grasse on the French Riviera, injuring several and prompting the government to briefly issue a terror warning.

The student, carrying two hand guns, a hunting rifle and two "training"grenades, entered the Alexis de Tocqueville A-level college and opened fire on Thursday morning, French time, local media reported.

The headmaster was among eight people injured in the attack, said a interior ministry spokesman. The headmaster was reportedly shot in the arm. A student was hit by a ricochet. The others suffered light injuries apparently in the panic.

However, other official sources suggested that only three people had been "lightly injured".

A police car blocks a road after an attack in a high school in Grasse, southern France. Photo / AP
A police car blocks a road after an attack in a high school in Grasse, southern France. Photo / AP

Police have arrested the shooter, who was "unknown to security services".

Marianna, a student at the college, told France Info: "I was in English class. We heard a gunshot. We didn't think it was an attack. We had the reflex to go under the tables.

"I went to shut the windows and a guy looked at me in the eyes. He looked like another student. He wasn't very tall. He shot in the air and then ran away. We stayed inside the classrooms until the police emptied the two floors."

Another pupil, Benjamin, 16, told Nice Matin: "At around 12.40pm, I was sitting down finishing eating. I heard a big bang and then two others. I turned round and saw someone in the playground firing a shotgun.

"He was shooting through the classroom windows overlooking the playground. When I saw that, I ran away."

Local emergency services advised residents on Twitter to stay at home. The government briefly launched its mobile telephone application warning of a "terrorist"attack and told people in the area to remain in a safe place.

But an interior ministry spokesman said: "It is clearly too early to confirm the motive for this attack." The terror alert application warning was later switched off.

Christian Estrosi, president of the Provence-Alpes-Cote d'Azur region, said that the attack appeared to be "not at all"terror-related.

Sources close to the inquiry said that the teenager had recently viewed videos of American school shootings. According to Le Monde, he was "fascinated"by the 1999 Colombine high school massacre in which heavily armed students Eric Harris and Dylan Klebold murdered 12 students and one teacher, and injured 21. The pair subsequently committed suicide.

Le Monde said that the Grasse shooter also "made references to Satanism"on social media. Posts on his Twitter account reportedly warned of the end of the world, and showed pictures of armed skeletons, a man with a chainsaw, wolves heads and scarred skin, said Libération.

There were earlier unconfirmed reports that police were hunting for a suspected accomplice. The town hall of Grasse, had said the shooting appeared to be linked to a "dispute between students". It said that two teenagers entered the school and tried to shoot a third student. One of the pair managed to escape.

But the interior ministry later said said it was thought there was only one shooter, who appeared to target the headmaster in particular.

Pupils in all schools in Grasse were confined indoors. Police said that all pupils were now "safe".

French secondary schools have carried out regular practice drills in case of shooting or bomb attacks in response to a wave of terror attacks in France in the past two years.

Grasse, renowned as the world's perfume capital, is 40km from Nice, where in July last year a terrorist drove a truck onto the promenade, killing 86 people.

The teenager school assailant reportedly posted an amateur video of the Nice attack on his Twitter account and berated commentators who said it was in poor taste.

The attack came shortly after a letter bomb exploded at the headquarters of the International Monetary Fund in Paris. It is not clear whether the incidents are linked.

It occurred less than six weeks before a presidential election in which security and fears of terrorism are among key issues.

On Thursday, President Francois Hollande confirmed that France would remain in a state of emergency, a day after his justice minister suggested that it might be lifted.

- Originally published in Telegraph UK