A teacher in a California classroom who accidently fired a gun in class, injuring three children, will resign after the academic year.

Dennis Alexander, a reserve police officer, had been teaching a class on 'Administration of Justice’ at Seaside High School on 13 March when he reportedly pointed the gun at the ceiling and it accidently went off.

Sandy City Police told Associated Press that he had been pointing the gun at the ceiling to make sure it wasn’t loaded when the weapon discharged.

Alexander was placed on administrative leave both as a teacher at the school and as a reserve police officer at the Sand City Police Department, and the school reportedly sent a letter to parents stating the incident was being “immediately investigated".

District policy says only school resource officers can carry guns on campuses, and Alexander was not authorised.

In the weeks following the incident, Alexander officially handed in his resignation which will become effective at the end of the school year. According to district spokeswoman Marci McFadden, speaking to CNN: "He currently remains on administrative leave while we continue our internal disciplinary process."

Seventeen-year-old Fermin Gonzales told KTVU-TV that he saw blood on his shirt after the gun fired.

Then I wiped my neck, kind of, and a bullet fragment comes off my neck.

His mum, Crystal Gonzales was “really upset” that paramedics were not called to make sure the children were not injured.

I’m still really upset no one called a nurse or a paramedic to come check on the students. They just sat there until the bell rang.

The incident follows a mass shooting that killed 17 people at Parkland school. US President Donald Trump had suggested that a way to combat mass shootings would be to arm teachers.

The US President tweeted this on the same day, and people quickly took note of the irony.

And lots of them criticised the incident, using it as a prime example of why teachers shouldn't be armed.

Family Guy creator Seth MacFarlane weighed in too.

This isn’t the first incident of a teacher’s unauthorised use of a gun in school. In February, a teacher in a school in Georgia was arrested after they barricaded themselves in a classroom and fired off a single shot. Nobody had been injured.

Sand City Police Department has been contacted for comment.