A school district in Pennsylvania spied on students through web cameras installed on laptops provided by the district, according to a class action lawsuit filed this week.

Lower Merion school district, in a well-heeled suburb of Philadelphia, provided 2,300 high-school students with Mac laptops last autumn in what its superintendent, Christopher McGinley, described as an effort to establish a "mobile, 21st-century learning environment".

The scheme was funded with $720,000 (£468,000) in state grants and other sources. The students were not allowed to install video games and other software, and were barred from "commercial, illegal, unethical and inappropriate" use.

The district retained remote control of the built-in webcams installed on the computers – and used them to capture images of the students, according to a lawsuit filed in federal court this week.

The ruse was revealed when Blake Robbins, a student at Harriton high school, was hauled into the assistant principal Lindy Matsko's office, shown a photograph taken on the laptop in his home and disciplined for "improper behaviour".

According to Robbins, Matsko said the school had retained the ability to activate the laptop webcams remotely, at any time. Backed by his parents, Robbins filed a lawsuit on behalf of all students provided with laptops by the school.

The suit claims a violation of the privacy and civil rights of the students and their families and accuses officials of violating electronic communications laws by spying on them through "indiscriminate use of an ability to remotely activate the webcams incorporated into each laptop".

It claims that since the laptops were used by students and their friends and family at home, images of "compromising or embarrassing positions, including ... in various states of undress" have been captured. A school district spokesman, Douglas Young, did not return a call seeking comment, but told the Philadelphia Inquirer the district was investigating. "We're taking it very seriously," he said.

In a letter posted on the school district's website, McGinley said the district had installed on the laptops a security feature that allowed the webcam to photograph the computer operator in the event the laptop is lost or stolen. He said that following the suit's filing, the district disabled the feature amidst a review of technology and privacy policies. He said the feature was activated only to help locate a lost or stolen laptop.

"The district never activated the security feature for any other purpose or in any other manner whatsoever," he wrote. "We regret if this situation has caused any concern or inconvenience among our students and families."