ST. CLOUD -- A St. Joseph teenager charged with child pornography has reached a plea agreement and will serve his sentence in a long term treatment program.

The Stearns County Attorney's Office says 18-year-old Ebin Bergerson has pleaded guilty to two felony counts of possessing child pornography. The remaining five counts against him will be dropped as part of the plea.

Stearns County Juvenile Division Chief Matthew Engelking says Bergerson was sentenced in what's called an Extended Juvenile Jurisdiction which includes both an adult sentence and a juvenile sentence. He was 17-years-old at the time of the offenses.

The adult sentence of 20 months in prison is stayed if Bergerson successfully completes the correctional program in Red Wing and an aftercare program. Bergerson must comply with all of the conditions in the order until he turns 21 years-old.

Some of the requirements include complying with predatory offender registration, no possession of pornographic material, regularly attend school or work and random drug testing.

According to a juvenile delinquency petition, The Minnesota Bureau of Criminal Apprehension alerted Stearns County authorities about child pornography being uploaded at an IP address where Bergerson was living in 2014. A search warrant turned up more than 300 images on a laptop computer and Bergerson's cell phone.