WEST BATH, Maine — A Woolwich man convicted of sexually assaulting a horse 10 years ago will serve at least nine months in prison after pleading guilty to 10 counts of possessing child pornography.

William Diemer, 31, was arrested in January and initially charged with 30 felony counts of possession of sexually explicit material involving minors younger than 16 and 12 years old. He was indicted in February by the Sagadahoc County grand jury.

Maine State Police investigators seized Diemer’s computer last fall after receiving a tip, Maine Department of Public Safety spokesman Stephen McCausland said at the time. Investigators said that between April 29, 2013, and Aug. 13, 2013, Diemer shared about 390 files on a peer-to-peer, file-sharing program.

The children shown on the pornographic files were allegedly as young as 6 years old. None of the children depicted in the pornography are believed to be from Maine, McCausland said.

Story continues below advertisement.

Diemer pleaded guilty to 10 of the 30 counts. For five counts, he was sentenced to five years in prison with all but nine months suspended and two years probation.

For the second five counts, Diemer was sentenced to four years in prison, all suspended, with another two years probation.

In exchange for Diemer’s agreement to plead guilty to 10 counts, the other 20 counts were dismissed, according to court documents. Judge Andrew Horton accepted the plea in April.

Under the terms of the sentence, Diemer must register as a sex offender, and he may not have contact with children younger than 16 or possess any computers or device capable of accessing the Internet. He also must be evaluated to see if sex offender treatment is necessary.

For that crime, he was sentenced to nine months in jail with all but 30 days suspended, required to undergo counseling and prohibited from owning or possessing domestic animals for the rest of his life.

Diemer is married but does not have any children, according McCausland.