A serial perv who allegedly snapped hundreds of up-skirt photos was busted by Spanish authorities who tracked online activity to catch him in the act, a report said.

The Spanish National Police arrested the man in Madrid on Wednesday while he was snapping an illicit shot using a camera hidden in a backpack, CNN reported.

They have since tied him to more than 500 incidents and believe he uploaded 283 clips of the footage to porn sites.

“The detained man generally recorded his victims in busy areas such as the metro before following them to the street,” the police said in a statement, according to CNN.

He “sometimes even introducing himself to them in supermarkets or shops in order to obtain better shots of their intimate areas, which he recorded in close proximity.”

The suspect, who is originally from Colombia, acted “compulsively” and targeted minors, authorities said.

Police tracked him down after they found the videos online, which had received millions of views, according to CNN.

Investigators then traced him using surveillance video and caught him in the act on Wednesday.