A former detention officer of the Converse County Sheriff's Office was sentenced to a term of probation Wednesday morning after being convicted in July of attempting to deliver prescription painkillers to people who turned out to be detectives.

Natrona County District Court Judge Daniel Forgey sentenced 37-year-old Michael Joe Martinez to two years of supervised probation with an underlying two- to four-year prison sentence. Martinez will also have to pay a fine of $2,000.

Assistant District Attorney Trevor Schenk, who recommended a term of probation rather than incarceration, said the circumstances were "almost baffling."

"I don't understand how a person like Mr. Martinez gets into that sort of situation," Schenk told Forgey during Wednesday's sentencing hearing.

A jury on July 13 convicted Martinez of attempted delivery of a controlled substance. He was found not guilty of a second charge.

Charging papers say an unnamed source in March told detectives that Martinez would be delivering 5-mg oxycodone pills near an address on Wilkins Circle in Casper. The arrangement was made online, and defense attorney Thomas Smith on Wednesday said Martinez responded in part due to sexual enticement, though the affidavit makes no mention of that.

When Martinez arrived in Casper with the pills, he was arrested. Schenk on Wednesday said it was "not a significant quantity" of oxycodone.

"It appears to be a one-off, maybe, crime of opportunity," Smith told the court, saying the pills were from a leftover prescription.