Sean Shaynak, formerly a math and science teacher at the elite Brooklyn Tech High School, pleaded guilty Tuesday to kidnapping, obscenity, and sexual abuse, among other crimes. Prosecutors say Shaynak sexually abused seven of his female students between 2011 and 2014; the kidnapping charge resulted from taking one of them, then 15, across state lines to a New Jersey nude beach.

Shaynak was initially charged with endangering the welfare of a child and disseminating indecent material to a minor, but as prosecutors began combing through his computer and phone, they found “thousands” of texts, photos, and videos showing he’d had inappropriate sexual relationships with at least six other students. (He also attracted considerable media attention for yearbook photos that showed him wearing a sexy French maid outfit and a creepy, midriff-baring, Britney Spears-esque schoolgirl uniform.)

Law enforcement officials told both the New York Times and the Post that they believe Shaynak had sex with two students once they turned 17, timing it to avoid statutory rape charges. Brooklyn prosecutor Joseph Mancino told the Post that Shaynak took one girl to a sex club out of state, where she had to watch him perform sex acts on other people and have sex acts performed on him. He also took the 15-year-old to the New Jersey nude beach, Mancino said, plied her with “Jack Daniel’s and tequila to the point where she passed out,” and tried to persuade her to have sex with another female student. He’s also accused of giving students he was grooming good grades, even if they turned in blank homework.

Shaynak pleaded guilty to second-degree kidnapping, sexual abuse, and obscenity, among other charges; he’ll serve five years in prison. He’s due to be formally sentenced January 16. He’ll have to register as a sex offender upon his release, and will, of course, never be allowed to teach again. Two of his victims sued the city’s Department of Education in January and March of this year, alleging that the DOE failed to protect them from abuse.