A Middletown math teacher, accused of trying to meet a 15-year-old girl for a possible sexual encounter, pleaded not guilty in Wallkill Town Court Thursday.

Jonathan Castell, 44, is charged with attempt to endanger a child, a class A misdemeanor. State Police say he'd been exchanging messages with a girl he thought was 15, but had instead been talking to a member of an online group that works to catch child predators.  

In a deposition, a member of the group says the two communicated through text messages, with Castell allegedlly sending a shirtless photo and agreeing to bring protection to a meeting in New York City. Someone else later confronted a man in the city believed to be Castell on video.

Earlier this month, the Middletown School Board suspended him from his job with pay. Castell was released with an appearance ticket Thursday and is set to return to court next month.