A former New Jersey State Police trooper has been sentenced to seven years in state prison for attempting to arrange a sexual encounter with a minor in Freehold, prosecutors said.

Shane H. Dempsey, 33, must serve at least two years before parole, register as a sex offender under Megan’s Law, and remain under Parole Supervision for Life. He was also stripped of his public position and permanently banned from future public employment in New Jersey.

Authorities say Dempsey contacted an undercover detective on the app Whisper, offered money for sex, and believed he was communicating with a 14-year-old girl. He was arrested after showing up to a meeting location in a police-issued vehicle.

Dempsey pleaded guilty in August to attempted sexual assault and official misconduct.