MOUNT HOLLY — A janitor at a Staten Island hospital faces prison after he admitted trying to arrange a sexual encounter with a teenager, who turned out to be a police detective.

John Emilio, 43, pleaded guilty to a charge of attempting to endanger the welfare of children. Under terms of a plea agreement with Burlington County prosecutors, he will face a 3-year prison term when he's sentenced in March.

Emilio became a suspect in November 2019 when the prosecutor's office initiated a proactive investigation into the exploitation of children in cyberspace and thought he was communicating with a 14-year-old. “During the investigation, Emilio initiated contact and sent nude pictures of his genitals,” the prosecutor's office said, adding that he was "very excited that he would be having sex with a girl so young, and looked forward to taking her virginity."

Emilio had discussed coming to Burlington County to have sex with the girl, either at a Route 130 motel or inside of his vehicle,

“Emilio had discussed coming to Burlington County to have sex with the girl, either at a Route 130 motel or inside of his vehicle, but the trip never materialized,” the prosecutor's office said.

The girl was actually a detective with the prosecutor's high-tech crimes unit.

(Copyright 2021 by The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)

LOOK: See the iconic cars that debuted the year you were born

NEXT: Popular NJ spots on latest list of bars facing suspensions