A teacher in northern California who also serves as a reserve police officer accidentally fired a gun inside a classroom, injuring three students, police have said.

Key points: Teacher and reserve police officer Dennis Alexander accidentally discharged gun during safety demo

Teacher and reserve police officer Dennis Alexander accidentally discharged gun during safety demo Student Fermin Gonzales sustained moderate injuries when bullet fragments lodged in his neck

Student Fermin Gonzales sustained moderate injuries when bullet fragments lodged in his neck Incident comes one month after Donald Trump suggested arming teachers to prevent massacres

High School teacher Dennis Alexander was pointing the gun at the ceiling to make sure it was not loaded when the weapon discharged inside his classroom at Seaside High School in the coastal community of Seaside, KSBW-TV reported.

It is understood the students were injured when the bullet ricocheted off the classroom ceiling.

The Seaside Police Department said no-one suffered "serious injuries".

One 17-year-old boy sustained moderate injuries when bullet fragments lodged in his neck, the student's father, Fermin Gonzales, told KSBW.

"It's the craziest thing. It could have been very bad," Mr Gonzales said.

Mr Alexander was teaching a gun safety lesson for his administration of justice class and was about to show the students how to disarm someone, Mr Gonzales said.

Mr Gonzales said no officials contacted parents to let them know what happened and that he was shocked when his son returned home with blood on his shirt and bullet fragments in his neck. He rushed his son to a hospital for X-rays.

"I'm just pretty upset that no-one told us anything and we had to call the police ourselves to report it," Mr Gonzales said.

A view of the bullet fragments removed from student's neck. ( KSBW )

Mr Alexander was placed on administrative leave from his teaching job and he was also placed on administrative leave at the Sand City Police Department, police and schools officials said.

Monterey Peninsula Unified School District sent a letter to parents saying its human resources department, the high school administrators and the Seaside Police Department, "immediately began investigating the incident, including interviewing students in the class".

It said counselling was made available to students and that it could not release any other details, "due to the nature of this personnel incident".

In the hours since the incident, students of the high school have started a petition to save Mr Alexander's job at the school.

Junior class president Sydney Johnson told KSBW Mr Alexander had changed a lot of lives for the better.

News of the incident emerged as thousands of students across the US staged an unprecedented national walkout demanding tighter gun control laws and came one month after US President Donald Trump's suggestion to arm teachers to prevent school massacres.

The crowd of hundreds outside the Capitol Building staged a mass sit-in. ( AP: Andrew Harnik )

AP/ABC