Perris High School – one of those subject to a month-long undercover investigation (Picture: Google Maps)

Pupils at two high schools must have had the shock of their lives when classmates revealed themselves as undercover police officers and arrested 25 students in the process.

In an operation that sounds remarkably similar to Channing Tatum and Jonah Hill movie 21 Jump Street, pupils were detained for drug offences after befriending what they thought were their contemporaries.

It was a month-long sting in which officers posed as students at Paloma Valley High School as well as Perris High School in California, in the US.

Authorities made 22 arrests on Thursday December 12, Riverside County Sheriff staff confirmed.

Of the students arrested two were adults, the Press-Enterprise reported, and all are suspected of selling drugs.

Officers are also seeking three more students who weren’t in class on the day of the arrests and are still at large.

Channing Tatum and Jonah Hill star in a movie about an undercover drugs bust at a high school (Picture: Handout/Getty)

Lieutenant Paul Bennett said that most of the drugs bought and sold were for small amounts of marijuana.