An Ogden man was granted a year-and-a-half of probation on Monday after pleading to possessing methamphetamine and firing a gun near a school.

Riley County District Judge Kendra Lewison granted Justin Bauer, 41, 18 months of probation per an agreement between defense and state attorneys after he pleaded no contest to possession of a controlled substance, criminal use of a weapon and unlawful discharge of a firearm.

Lewison sentenced Bauer to underlying sentences of 10 months for the possession charge and six months each for the weapon-related charges. He will serve the remainder of his time in jail only if he violates probation terms. All sentences are running concurrently.

Officers arrested Bauer in April after they received a report of shots fired by a man with a gun walking in the 300 block of 11th Street in Ogden. Police said the man entered an occupied business and acted “erratically.” Police detained him without incident. Authorities reported no injuries.

Police closed the 200 block of Riley Avenue and locked down Ogden Elementary school temporarily because of the incident.

Authorities issued a warrant for Bauer’s arrest for drug possession after the gun arrest. The warrant indicated the drug incident in March.

Bauer also will be required to complete a drug treatment program though Bauer’s attorney said he has already started the process.

“I put myself through rehab and drug counseling before I even knew that was going to be an option,” Bauer said before his sentencing. “I knew I needed help. … I’m ultimately glad it happened because I’m drug free, and I’m just trying to be a better man.”

Lewison granted Bauer up to 20% good-behavior credit for time spent in jail, set his post-release supervision duration for 12 months, and ordered him to repay $720 in fees and court costs.