BANGOR, Maine — A local man was sentenced Thursday in U.S. District Court to 20 years and 10 months in federal prison for sexual exploitation of children, according to the U.S. attorney’s office.

Andy Quinn Goodall, 29, of Bangor also was sentenced to a lifetime of supervised release.

Goodall pleaded guilty to the charge in January.

By pleading guilty, Goodall admitted that he took sexually explicit images of two prepubescent minors, uploaded them to a foreign website and provided links to the images in emails he sent others, according to court documents. He also possessed hundreds of images and dozens of videos of child pornography.

“There is a giant step between viewing images and producing them,”

U.S. District Judge John Woodcock said in sentencing Goodall, according to a press release issued by the U.S. attorney’s office. “The defendant was in a position of trust. He was babysitting the victims. He consciously and intentionally violated this trust. The role of a judge in a case like this is to protect the people who can’t protect themselves.”

The investigation that led to Goodall’s arrest began in August 2015 after an agent with Homeland Security Investigations, who was monitoring a website where child pornography was traded, traced pictures of a young boy and girl to Goodall’s IP address, according to court documents.

When interviewed by investigators on Sept. 22, 2015, Goodall confessed to taking photos of naked children and children in their underwear. He also admitted to sexually assaulting a child, the complaint said.

Goodall faced between 15 and 30 years in prison and a fine of up to $250,000.

The case was investigated by the Penobscot County Sheriff’s Office, Bangor police and the U.S. Immigrations and Customs Enforcement’s Homeland Security Investigations.