Interior ministry spokesman Pierre-Henry Brandet told France Inter radio that three people had been injured in the attack at Tocqueville High School.
France is still in a state of emergency after a series of terror attacks that included a massacre in Paris in November 2015, claimed by the Islamic State group, and a truck attack in Nice, just 40 kilometers from Grasse, in July previous year. None of the injuries was life-threatening.
Early reports from the city suggest that the teenager caught by police was generally a well-behaved person.
Witnesses interviewed by local television described a scene of panic as the gunman entered the canteen with students rushing to hide under tables or sprinting for the exit.
Moreover, in France such checks entail acquiring and maintaining "an active shooting club [membership]" and going to the range "at least three times a year".
Two people have been injured in the attack and police has shut down the school for now.
After the incident, schools in Grasse were locked down.
Regional president Christian Estrosi said they are "not at all" treating it as a terror attack at this stage.
"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.
Both local residents would not provide their names.
The government launched a mobile telephone application warning of a "terrorist" attack, although this is now automatic for any such incident. The alert is part of a system implemented by the government after the deadly November 2015 attacks in Paris.