BAKERSFIELD, Calif. (KGET) — A Kern County judge on Friday ruled a man accused of stabbing a deputy can enter a mental health diversion program where the charges against him will be dismissed if he follows a treatment plan and stays out of trouble.

Judge Michael G. Bush granted Reginald Anderson entry into the two-year program over the objection of prosecutors. Assistant District Attorney Joseph Kinzel said Anderson will face no criminal consequences for his “unprovoked assault on a sheriff’s deputy” if he successfully completes the program.

The treatment plan calls for Anderson to be released from jail and placed in a residential rehabilitation facility.

“The district attorney considers Anderson’s release an unreasonable risk to public safety, and intends to request the judge reconsider the decision,” he said.

Anderson is due back in court July 22 for a status hearing in the case.

Early July 14, 2019, Anderson armed himself with a knife at his home and called 911, according to court documents filed in the case. Deputy Richard Griffee arrived and Anderson refused commands to remove his hand from his pocket.

Body-camera footage released by the sheriff’s office shows Anderson lunge at Griffee with the knife. Gunshots are then heard.

Griffee suffered moderate injuries from a cut to his arm. Anderson received gunshot wounds and recovered at a local hospital before being transferred to jail.

He has pleaded not guilty to attempted murder, assault with a deadly weapon other than a firearm on a peace officer, brandishing a firearm or deadly weapon to avoid arrest and resisting a peace officer resulting in death or serious bodily injury.