A man accused of giving his wife the prescription painkiller that contributed to her death in July entered a guilty plea Thursday morning in Albany County District Court.

Paul Standford Harper, 36, pleaded guilty on one felony count of delivery of a controlled substance. He could face up to 20 years in prison and a $25,000 fine at sentencing.

In exchange for the guilty plea, the state will remain silent at Harper's sentencing hearing. The plea agreement does not include a sentence recommendation by the state -- meaning while the state will not argue for the maximum sentence, it is on the table.

Harper told the court Thursday that he gave his wife, Kaylee Dawn Harper, hydrocodone that was legally prescribed to him. He said his wife asked him for the drug after her previous prescription ran out.

Kaylee Harper was found dead in her home by the couple's children on the morning of July 8.

According to court documents, Paul Harper told police that he and his wife had been drinking heavily the night before -- July 7 -- at a Laramie bar.

Harper gave his wife one hydrocodone tablet while they were drinking. Later in the evening, Harper says his wife left the bar to pick up their children around 2:30 a.m. She got home around 3:30 or 4 a.m., according to the affidavit, and Harper reportedly told police that he knew his wife was drunk but allowed her to drive with the children.

Court documents say Harper also told police that his wife's body was "beginning to shut down" after she got home. He also said he should not have left his wife to go to work that morning, according to the affidavit, because she "wasn't too functional," was "shaking real bad" and was "really drunk."

Kaylee Harper evidently took two more hydrocodone pills after returning home. Court documents say Paul Harper left the two pills on top of the refrigerator for her, and they were not there when police searched the house.

According to a toxicology and autopsy report referred to in court documents, a forensic pathologist determined the cause of death to have been respiratory depression due to the combined effect of alcohol and hydrocodone in Harper's system.

Her death was ruled an accident.

Kaylee Harper's last valid prescription was filled June 3, according to court documents, and was a three-day script. Paul Harper's most recent prescription was filled June 27 when he received 60 tablets for a period of 15 days.

"Which was prescribed legally by a doctor," noted prosecutor Kurt Britzius in court Thursday. Britzius said the fact that such an amount -- which indicates a consumption rate of four pills per day -- was prescribed legally is "disturbing."

Harper told the court that he gave his wife the pills from his prescription because she previously had back surgery and would get "very bad pain," according to court documents.

Kaylee Harper at the time was not able to get her prescriptions because she had been unable to transfer her medical records from California, according to Paul Harper's statements to the court and police.

Harper's prescription stemmed from a back injury he sustained while at work roughly two years ago. He told Albany County District Court Judge Jeffrey Donnell Thursday that his hands and knees still hurt constantly.

"It sounds more like an addiction problem on the part of both of you," Donnell told Harper.

Harper remains free on $10,000 signature bond pending sentencing. A sentencing date will be set once the presentence investigation report is complete.

Harper told Donnell that he no longer takes hydrocodone and uses Tylenol instead, saying it works "for the most part."

"It's a shame, Mr. Harper, that somebody had to die to get you to go to Tylenol," Donnell replied.