A York man was sentenced to two years in prison followed by three years of supervised release for sending threatening emails to police and educators using a spoofing service that mimicked the address of a New Hampshire police chief.

Austin Santoro, 23, pleaded guilty in December to transmitting a threatening interstate message and identity theft, the U.S. Attorney’s Office said in a release.

Court documents show that in January 2018 Santoro emailed the employees of the police department in Portsmouth, New Hampshire, threatening to sexually assault them at gunpoint. He used an email “spoofing” service to make it appear that the message came from the police chief.

On the same day, Santoro also sent a similar email to a York County Community College professor while posing as a college employee. He originally faced 11 charges, and is alleged to have sent 36 emails in total. He is alleged to have also sent messages to the Kittery police department.

In addition to the threats, some of the messages contained lewd images and racist statements, court records show.

According to court records, Santoro had some connection to most of those he targeted; some appeared to have played a role in a negative episode in his life, including a police officer who arrested him for OUI in 2017 and a college professor who failed him in an online course.