A creepy former high school teacher in Missouri has admitted to secretly recording teenagers in a basement bathroom at his home for five years, federal prosecutors said.

William Derek Williams, 39, pleaded guilty Monday to producing child pornography, admitting that he surreptitiously taped three underage victims in his Cameron home between January 2013 and September 2018, the US Attorney’s Office for the Western District of Missouri announced Monday.

Williams taught multimedia classes part-time at Cameron High School during that span and previously worked as a language arts teacher at the school.

A 15-year-old victim found a hidden camera in September 2018 in Williams’ bathroom that was designed to look like a cellphone charger. After opening the device, the teen found a micro SD card, which he then put into his own cellphone to view its contents — only to find a secretly recorded video of himself, prosecutors said.

The teen turned the device over to authorities, who later seized a laptop and an SD card from Williams’ home. Investigators then found pornographic videos of two other teens between the ages of 14 and 16 who were unknowingly filmed in the teacher’s basement bathroom, according to prosecutors.

Williams faces a mandatory minimum sentence of 15 years in federal prison without parole at his sentencing — which has not yet been set — although he could receive up to 30 years.

Williams has separately pleaded not guilty to charges of second-degree statutory sodomy, sexual exploitation of a minor and possession of child pornography filed against him in state court just months before his federal indictment, stemming from allegations dating back to 2015, the Kansas City Star reports.