A New York substitute teacher has been arrested after he allegedly tried to take photos and video of a high school student inside the school's bathroom on Tuesday, the Times Union reports.

The 42-year-old Jeffrey Wellman attempted to violate the Shaker High School student's privacy while the student was inside a stall. Wellman was charged with felony unlawful surveillance.

Authorities said Wellman was trying to take pictures of a 17-year-old boy, who caught the substitute in the next stall over, holding a cell phone under the divider, which flashed. The boy then tried to grab the man, but he ran out of the bathroom and escaped the school, though not before the student was able to capture video of the creep.

“He tried to grab onto the guy and grabbed his pants underneath the stall but obviously it’s a fairly difficult situation and he was not able to hang onto him for very long,” Colonie police Lt. Bob Winn told CBS 6 Albany. “But he did take his own cellphone and was able to capture at least some images of the suspect which included the ID tag hanging around his neck, which identified him as staff at the school.”

Thanks to the student's video and footage from the school security system, Wellman was later identified.

"We encourage our students to speak up when they see something that is improper, inappropriate, wrong. The student did that and we’re proud of this student and the student did the right thing," North Colonie Superintendent Joseph Corr told CBS 6 Albany, stating that Wellman has been employed with the school district since 2014. "So he was not exclusively at Shaker. There is potential he was at other schools."

The substitute teacher is "no longer working in the district," North Colonie Central Schools said in a statement.

Also Watch