SAN DIEGO — A 15-year veteran with the San Diego County Sheriff’s Department was sentenced to two years probation Monday, after he was arrested in January for drug possession and 13 counts of burglary.

Prosecutors say Deputy Cory Richey took advantage of his access to patrol stations after hours, taking prescription medication from public drop boxes, which people are encouraged to use to safely get rid of unwanted or expired medication.

Richey’s attorney Earll Pott read a statement, explaining why Richey stole the drugs.

“Unfortunately, while on duty, he sustained a severe neck injury caused by an inmate and became addicted to opioid painkillers that were prescribed to him for two years. At the depths of his addiction, he accessed discarded medications left at drop boxes at the sheriff’s facility,” Pott said.

Richey, a Riverside County resident, was working at the downtown San Diego detention facility, but each time, took the drugs from the sheriff’s substation in Vista.

“There is no evidence Mr. Richey was doing anything with any of the narcotics he obtained other than using them personally,” Deputy District Attorney Cal Logan said.

Before making a plea deal about a month ago, Richey faced up to 13 years in prison.

He has been out of custody and has completed a residential drug rehabilitation program.

“He’s going to suffer severe consequences as a result of his plea. He just wants to move out with his life now and continue his commitment to sobriety,” Pott said.

Richey’s status with the sheriff’s department is unclear – his attorney said he remains on administrative leave.