A California teacher who also serves as a reserve police officer accidentally fired a pistol inside his classroom while teaching about gun safety and injured three students, according to reports.

Dennis Alexander was teaching public safety awareness in his administration of justice class at Seaside High School when he fired a semi-automatic handgun and hit the ceiling, KSBW reported.

Teachers are not permitted to possess firearms in California schools.

The errant bullet ricocheted off the ceiling, sending out fragments that injured three students, including a 17-year-old who was struck in the neck, the boy’s dad, Fermin Gonzalez, told the station.

Seaside police said in a statement that no one suffered serious injuries.

Alexander had just told the class that he wanted to make sure his gun wasn’t loaded when it went off, leaving the children stunned, Gonzales said.

“It’s the craziest thing. It could have been very bad,” Gonzales said, adding that the teacher was about to demonstrate how to disarm a person.

Alexander, a reserve cop in the Sand City Police Department, has apologized for his ballistic blunder.

He was placed on administrative leave at Seaside High School and the police force as the investigation is conducted.

“I have concerns about why he was displaying a loaded firearm in a classroom. We will be looking into that,” Sand City Police Chief Brian Ferrante told KSBW.

Gonzales complained that no one at the school checked to make sure the children were unhurt before the school day resumed.

The 17-year-old’s parents were shocked when he came home with a blood-soaked shirt and a neck wound.

“He’s shaken up, but he’s going to be OK,” Gonzales told KSBW. “I’m just pretty upset that no one told us anything and we had to call the police ourselves to report it.”

Ferrante said Alexander — who also is a Seaside City Council member — has been a reserve officer for the past 11 years, and described his track record as “positive and professional.”

Seaside Police Chief Abdul Pridgen said he doesn’t know if Alexander had ever brought a firearm to the school before.

“We’re looking into any violation of city ordinance or the penal code and we’ll determine whether or not there are any applicable charges,” Pridgen told the Mercury News.

Monterey Peninsula schools chief PK Diffenbaugh said: “I think a lot of questions on parents’ minds are, why a teacher would be pointing a loaded firearm at the ceiling in front of students.”

The frightening incident occurred amid a national debate over whether to arm teachers in the wake of the school shooting that left 17 dead in Parkland, Florida.

On Wednesday, students across the nation planned to walk out of their classrooms to raise awareness about gun violence and safety.

One KSBW Facebook fan wrote: “This is clear example why teachers shouldn’t have a gun. Accidents happen, even to people with experience.”

Another person added: “Oh great.. .Ya let’s give ALL the teachers guns. What could possibly go wrong?”