A California teen’s attempt to take the law into her own hands reportedly backfired when she was kidnapped by a 32-year-old man who she tried to catch for allegedly preying on underage girls.

The victim was trying to prove that Robert Dreyfus, 32, solicited sex from young girls he met on social media when he drove off with her at about 2:30 p.m. Sunday in Vista, Ca., according to KGTV.

The girl’s attempted sting began when she and her friends used a social media app to contact Dreyfus, authorities said.

The group then exchanged text messages with the suspect to arrange a meeting in a parking lot where they planned catch Dreyfus’ misdeeds and turn over their evidence to law enforcement.

But officials said the amateur sting operation went horribly awry when Dreyfus “convinced the 17-year-old victim to get into his vehicle to talk,” before driving off with her.

The teen contacted her friends, who called police. Cops eventually caught up with Dreyfus, who let the unharmed teen out of his car, the report said.

Local authorities used the encounter to warm against vigilante justice.

In a statement to KGTV, the sheriff’s office said the public is discouraged “from setting up meetings or contacting anyone for the purpose of catching an individual who is committing a crime.”

Dreyfus was charged with suspicion of kidnapping, sending harmful matter to a minor and communication with a minor for specific offenses.