25 high school students have been arrested for drug offences in the US after undercover officers infiltrated their social groups.

In events that echo the plot of 21 Jump Street, the Johnny Depp TV series and subsequent Jonah Hill and Channing Tatum film, one male and one female officer posed as teens in their second-to-last year of high school for an entire term.

Students were arrested on suspicion of selling drugs at two schools in California as a result of the operation.

Download the new Independent Premium app Sharing the full story, not just the headlines

Two of those arrested were over 18 while three, who were not at school when officers descended on the campus, remain at large, Riverside County sheriff’s officials said.

Over the course of the investigation, officers seized drugs including marijuana, cocaine, crack cocaine, methamphetamine, hashish and various prescription pills, police said.

Lt. Paul Bennett added that most of the drug purchases were for small amounts of marijuana.

Trevor Steinrichter, 16, told The Press-Enterprise that officers walked into his history class. “Scary. I saw my friend get arrested,” he said.

Bruce Hollen, 16, added that he found it disturbing to think police were posing as students. “You think you can trust people – you just never know,” he said.

Jonathan Greenberg, superintendent of the Perris Union High School District, said he had no reservations when the Sheriff’s Department proposed the undercover operation. “It was a question of what we could do to assist them,” he said.

“This is a very well-researched programme,” he added. “The people in it are all professionals.”

Undercover police stings in high schools are not entirely out of the ordinary in the US, with the Los Angeles Police Department pioneering the tactic decades ago.

The programme was however discontinued in 2005 after Los Angeles Unified School District officials said increasingly, the students arrested were in special education and that the amounts of marijuana were often very small.

Critics of such operations say that it is unfair to target teenagers, who are often emotionally vulnerable. "Sending police and informants to entrap high-school students is sick," Tony Newman of the Drug Policy Alliance told radio station This American Life, after details of the busts were released.

“More often than not the drug war is ruining young people's lives and doing much more harm than good,” he added.