ROCKLAND, Maine — A local woman will avoid jail time if she adheres to a series of conditions after admitting to endangering the welfare of her 3-year-old son, who was found lying in a drainage ditch but unharmed near her apartment complex.

Mandy J. Dennison, 27, pleaded guilty Oct. 27 in Knox County Unified Court to endangering the welfare of a child, possession of the sedative clonazepam, possession of suboxone and violating a condition of release.

Under terms of a deferred disposition reached with the district attorney’s office, the endangerment charge and the clonazepam charge with be dismissed and she will be fined a combined $900 on the remaining two charges if she meets the conditions of the deal over the next 12 months. The agreement requires her to undergo psychological counseling and to meet any conditions placed on her by the Maine Department of Health and Human Services.

The incident occurred April 23, when a man found the boy lying in the ditch shortly after 6 p.m.

The boy was unable to tell police where he lived but said he had been watching “Scooby Doo” on the television. The officer checked nearby apartment complexes and found one with a door open. “Scooby Doo” was playing on the television.

Officer Andrew Redden knocked on the door and, after getting no response, entered to check on the welfare of anyone inside. He found Dennison sleeping on a mattress in the living room. After several attempts, he was able to wake up the woman, who said she did not know where her son was.

The officer said Dennison appeared to be under the influence of drugs and was found in possession of clonazepam, an anti-anxiety medication, which wasn’t prescribed to her.

She was arrested and taken to the Knox County Jail in Rockland. The following evening, after she had been released on bail, police conducted a check on Dennison to verify compliance with the conditions of her release. Dennison was found to be in possession of a different medication for which, again, she had no prescription, according to police.

Dennison was re-arrested and released on bail.