A former Wisconsin high school teacher accused of secretly videotaping undressed students during field trips was sentenced Friday to 12 years in prison after reaching a plea deal with federal prosecutors.

David Kruchten, 39, of Cottage Grove, Wisconsin, earlier pleaded guilty to one count of attempting to produce child pornography.

Prosecutors alleged Kruchten used his position as a business teacher at Madison East High School to secretly videotape students during field trips in Wisconsin and Minnesota.

David Krutchen Booking Wisconsin Teacher

David Kruchten was charged after an indictment was unsealed accusing him of attempting to produce child pornography. (Courtesy Dane County Sheriff's Department)

According to court documents, he accompanied East High’s business club students on overnight trips to Wisconsin Dells and Lake Geneva as well as Minneapolis in 2019. Students discovered hidden cameras planted in air fresheners in their hotel rooms during the Minneapolis trip. Investigators discovered similar air freshener cans in photos taken by students during the Wisconsin trips, prosecutors said.

DC MAN CHARGED IN 2020 SHOOTING OF VIRGINIA TECH GRAD AFTER SECOND ALLEGED MURDER THIS WEEKEND

Kruchten was charged last year with multiple counts of attempting to produce child pornography and resigned from his teaching job.

In an eight-page handwritten letter filed earlier this week in U.S. District Court, Kruchten wrote that he started spying on family "to deal with stress and fulfill a need for adrenaline" and to find out what they said about him when he wasn’t around, the Wisconsin State Journal reported.

MARYLAND THIEF ABANDONS STOLEN CAR AFTER DISCOVERING TWO CHILDREN IN BACK SEAT

That led to planting hidden cameras to capture pets, family, friends, babysitters and even his parents and grandparents, before he began spying on his students, Kruchten wrote in the letter to U.S. District Judge James Peterson.

"That was not my goal when I went into teaching and it was not my goal when I started on this course of behavior," Kruchten wrote. "My goal was not a collection of child pornography. My interest in these voyeuristic videos was not to capture students engaged in sex acts, my interest was the same (as) it was with my grandparents, and my pets and my wife — to see what people do when I’m not there."

CLICK HERE TO GET THE FOX NEWS APP

However, he wrote, it would be a lie to say there was "zero sexual component."

Peterson also sentenced Kruchten to 20 years of supervised release to follow his time in prison.