A Bar Nunn man will spend two to four years in prison after pleading guilty to child pornography and marijuana possession charges.

Chadrick Allen Cogdill entered entered his pleas to the felony child possession and misdemeanor drug charges during a hearing before Natrona County District Court Judge Daniel Forgey on Wednesday.

In exchange for the guilty pleas, Assistant District Attorney Dan Itzen said the state agreed to the prison term and would drop a second child pornography possession count. The plea is a "cold plea," meaning any violation of the law or unwillingness to cooperate with authorities before his sentencing could mean the deal is off, Itzen said.

During the plea, Cogdill told Forgey the child pornography was on his cell phone. He also admitted to having marijuana and drug paraphernalia.

He previously pleaded not guilty to the charges in May.

Cogdill remains free on bond. A sentencing date will be set later.

He was arrested in December after a four-month investigation, according to court records.

On Sept. 5, an agent with the Wyoming Division of Criminal Investigation's Internet Crimes Against Children Task Force was reviewing the BitTorrent network for people sharing child pornography. The agent found a file of interest in child pornography investigations and focused on a specific Internet Provider (IP) address.

Cogdill was identified as the IP address account holder, and agents determined he was living in Casper.

A search warrant executed on Verizon Wireless and Synchronoss platform provider found about 150 images of an prepubescent female in various stages of undress.

An agent also saw photographs of marijuana.

In November, Cogdill moved from Casper to Bar Nunn and didn't leave a forwarding address and disconnected his internet service.

He rejoined social media in early December.

Later that month, law enforcement agents executed a search warrant for Cogdill's residence and person. They found a phone, computers and marijuana paraphernalia.

During an interview with agents, Cogdill said he had seen child pornography on internet forums, but denied intentionally downloading or sharing any images.

He later admitted to using peer-to-peer file sharing software, and used uTorrent to download files.

Cogdill told investigators he found child pornography online by using search terms consistent with images of child exploitation, but later stopped searching after his son was born, according to court documents.

The government regards child pornography as a crime of violence because it involves sometimes brutal assaults on young children who cannot give consent to sexual activity.