A police officer was arrested after a California student used Snapchat’s popular “gender swap” filter to pose as an underage girl on a dating app, in a vigilante effort to lure potential pedophiles.

According to reports, the student created a Tinder account claiming to be a 19-year-old girl named “Ester” in order to meet Tinder’s minimum age requirements. Shortly after, he was allegedly contacted on the dating app by 40-year-old Robert Davies, a police officer in San Mateo, California.

“It turned out that with the gender filter I made a very pretty girl,” the student, who only identified himself as Ethan, told Good Morning America. “I decided to take advantage of it and try to make a Tinder account to catch some pedophiles.”

Although the fake account stated that the girl was 19, Ethan claims he repeatedly told Davies he was 16-years-old. Police say the two then discussed engaging in sexual activity, despite Davies believing the subject was an underage girl.

“He started talking about all the things he wanted me to do to him and what he wanted to do to me,” he said during the interview.

Ethan provided screenshots of his conversations with Davies to authorities.

In a statement to CTV News.ca, the Santa Clara County Deputy District Attorney O’Bryan Kenney confirmed that Davies has been charged with one count of contacting and communicating and attempting to contact and communicate with a minor, with intent to commit a specified crime.

“Although someone in this case posed as an underage victim, there are – tragically – so many children who are victimized by internet predators,” read the statement.

“We will work hard to hold this defendant accountable, but we urge parents to discuss with their kids the real-life dangers of communicating with strangers online.”

The district attorney’s office added that it does not recommend people take investigations into their own hands.

“We do not recommend members of the community attempt to investigate these matters on their own. There are officers who are well-trained to investigate these crimes,” said Kenney.