A former Brunswick police officer pleaded guilty to attempting to send obscene material to a minor.

Garrett G. Brosnan, 25, was arrested in June after an investigation that began in October 2015, when the parents of a 13-year-old girl in Arizona complained that someone had engaged in a online conversations that were sexual in nature with their daughter. According to the allegations, a Department of Homeland Security agent, posing as a 14-year-old girl, then began having conversations with Brosnan, who, they said, sent pictures of his genitals in June.

Brosnan also allegedly sent videos in which he winks, blows kisses and asks for the person he thought was a girl to send pictures in return.

Brosnan this week waived indictment in U.S. District Court in Portland and pleaded guilty, according to the U.S. Attorney’s Office.

He resigned from the Brunswick Police Department in June, according to Police Chief Richard Rizzo.

He faces up to 10 years in prison, a fine of up to $245,000 and supervised release of up to three years. A sentencing date has not been set.