CARO, Mich – A Bay County sheriff’s deputy who fired his gun inside a school and grazed a teacher was sentenced to a month in jail.

Former Bay County Sheriff’s Deputy Adam Brown was in a robotics classroom with the teacher at Bay City Western High School around 12:30 p.m. on Nov. 11 when they used a machine to test the trigger pull on Brown’s personal 9mm handgun, Mlive reports.

MORE NEWS: Know These Before Moving From Cyprus To The UK

Investigators allege Brown returned alone to use the machine to test the trigger on his .380 Sig Sauer, but did not empty all of the bullets. The gun allegedly fired during the test, went through two layers of drywall and into and adjacent classroom with 30 students. The bullet scraped off a ceiling tile, ricocheted off a concrete wall and struck teacher Brenda Amthor in the neck.

Amthor received a small scratch from the bullet and was otherwise uninjured. She’s since racked up nearly $500 in counseling expenses since the incident, according to the news site.

The woman continues to suffer emotional trauma from the incident and will continue to require counseling, WSGW reports.

“That bullet ricocheted three times before it actually struck a teacher in the neck, and of course the velocity dissipated at that point so you didn’t suffer significant injury. But it went above the children’s heads so what potentially could have occurred here and ultimately what did, certainly the hand of fate looked upon everybody who was present that day, including the defendant,” Tuscola County Prosecutor Mark Reene told the court, according to WJRT.

Brown, a 21-year veteran of the sheriff’s department, discussed the incident with school staff but did not admit to firing the gun. During the investigation, school staff gave Brown the bullet to hold, and he allegedly tossed it in a grassy area of the schoolyard but it was later recovered by a police dog.

Brown later admitted to firing the gun and attempting to cover it up.

MORE NEWS: How to prepare for face-to-face classes

Michigan State Police investigated the case and it was referred to the Tuscola County Prosecutor’s Office to avoid any conflicts of interest.

Brown was charged with a felony of tampering with evidence, and pleaded no contest as part of a plea bargain that delayed the sentencing on the felony charge for one year. On Monday, Bay County Circuit Judge Harry P. Gill sentenced Brown to serve 30 days in jail, and said the felony will be downgraded to two misdemeanors if he completes the stint and does not acquire more charges by April 23, 2018, Mlive reports.

Brown apologized during the Monday hearing, and acknowledged that he let down local school and law enforcement communities, the Detroit Free Press reports.

“I just want to say that I let them down and I’m really sorry and I am willing to fulfill the orders of the court and I appreciate you allowing me to talk,” Brown told the judge.

Judge Gill also spoke about the “very difficult case.”

“There is no question … that you have led an exemplary life. I think you are probably a fine human being,” Gill said.

“For a guy that has spent his adult life concerned about firearms safety, this was a very adolescent act,” he said. “But there are more important aspects of this case. There are two reasons I would surmise that police officers are in school. One is the obvious one of security, and the second one is as a role model.

“It appears for many, many years you were exemplary as a role model. You mad a very poor decision to lie about what happened. You attempted to destroy evidence, or to hide it. What you did was a very human decision – one that many of us might make,” Gill continued.

“Many of us being human may not have had the courage to do the right thing, but it was the wrong decision,” he said. “The court needs to take cognizance that it was the wrong decision.”

“I feel that because of the circumstances, it’s necessary I impose some incarceration,” Gill said. “I need to show the school community that even good people who make mistakes need to be punished.”

Brown’s attorney cited his long unblemished career with the Bay City Sheriff’s Office and service as a school resource officer at Bay City Western High School and Middle School, and asked Gill to hold the 30 day jail sentence in abeyance so Brown could work off restitution owed to Amthor, but Gill declined the request and ordered Brown into custody immediately, Mlive reports.

“Good luck to you, sir,” Gill said. “I take no pleasure in this.”