A former teacher was sentenced to prison Tuesday for assembling homemade scrapbooks containing pornography and pictures of naked children and bringing them to school, where he reportedly masturbated between classes.

Michael Scott Hatfield, 59, was accused of covering his in-class camera while he looked at the child pornography that he had cut-and-pasted into two albums. He had taught eighth grade at American Preparatory Academy in West Valley City, according to School Director Cindy Barrs.

Hatfield had entered no contest pleas to four counts of second-degree felony sexual exploitation of a minor, as well as three counts of class A misdemeanor counts of accessing pornographic material or indecent material on school property.

“This represents serious, reprehensible conduct,” 3rd District Judge L. Douglas Hogan said at Tuesday’s sentencing hearing.

Hogan sentenced Hatfield to one-to-15-year terms for each of the second-degree felonies, to run concurrently. The judge also gave Hatfield credit for time served, determining that the 370 days he has already served in jail was sufficient punishment for the misdemeanors.

Defense attorney Heather Chestnut said after the hearing that she intends to file an appeal relative to the definition of child pornography in Utah, saying that the pictures of the children aren’t considered pornographic under state law.

Hatfield had stuck photos of children — some clothed, some naked — onto pages pasted with photos of adult pornography and sexual language, she said.

She argued that the photos of nude children — some of which she said came from art books, design books, photography books — wouldn’t be considered pornographic outside of the scrapbook. (For example, she said, a parent’s photo of a child in a bathtub isn’t considered pornographic).

“No children were sexually abused or exploited in any way to make these other than that their images maybe appeared on their pages,” she said.

Prosecutors showed the judge several pages from the scrapbooks — both of which are approximately 4-by-6 inches in size — while Hatfield stood nearby.

Hatfield hardly moved.

Later, the judge asked him why he included a particular image, a photo of children to whom Hatfield is related. That page “stabs at my soul,’’ Hatfield responded.

“The image itself ... ,” his voice broke as he struggled to complete the sentence. “I don’t know how to answer.”

Covering the classroom camera started out as a way to give himself privacy to grieve for his father, but things “escalated and spiraled to a dark place,” Hatfield said.

He apologized to his family, former students — “who were surely confused and frightened,” he said — and former colleagues.

For 27 years he had been a teacher, Hatfield said, adding that he had “never crossed the line with a student.”

Nor had he ever been more “profoundly remorseful” about anything in his life, he said.

He was originally charged last May with seven counts of second-degree felony counts of sexual exploitation of a minor, as well as three class A misdemeanor counts of accessing pornographic material or indecent material on school property.

Chestnut said her client has been diagnosed as being on the autism spectrum, and didn’t understand social cues.

Hatfield was arrested one year ago, after an investigation started when a school employee reportedly noticed Hatfield cover his in-class camera three times in April.

Before covering the camera, Hatfield pulled a black bag out of his desk, the official saw.

But the microphone still captures audio, and the official heard sounds that suggest Hatfield was masturbating, according to court documents.

Administrators later retrieved the bag and found two albums containing of inappropriate material and contacted police.

In the scrapbooks, a West Valley City police detective saw pornography, mostly in the form of “collage-style pages which included cutouts and photos of nude girls,” court papers state.

“Each page was unique, depicting a level of meticulous attention in the creation and compilation of the album,” charges continue.

Police served a search warrant on Hatfield’s home, and found evidence related to creating the scrapbook, according to charges.

In a statement released last May after Hatfield’s arrest, American Preparatory Academy executive director Carolyn Sharette said the academy was “deeply concerned should any employee have inappropriate materials in possession on school grounds.

Hatfield was hired in 2013 and dismissed after his arrest.