The Supreme Judicial Court overruled a lower court that had upheld charges against Michael Robertson, who was arrested in August 2010 by transit police who set up a sting after getting reports that he was using his cellphone to take photos and video up female riders' skirts and dresses.
The ruling immediately prompted top Beacon Hill lawmakers to pledge to update state law.
Existing so-called Peeping Tom laws protect people from being photographed in dressing rooms and bathrooms when nude or partially nude, but the way the law is written, it does not protect clothed people in public areas, the court said.
"A female passenger on a MBTA trolley who is wearing a skirt, dress, or the like covering these parts of her body is not a person who is 'partially nude,' no matter what is or is not underneath the skirt by way of underwear or other clothing," the court said in its ruling.
State law "does not apply to photographing (or videotaping or electronically surveilling) persons who are fully clothed and, in particular, does not reach the type of upskirting that the defendant is charged with attempting to accomplish on the MBTA," the court said.
The SJC said that while such actions should be illegal, they are not, given the way state law is written.
Suffolk County prosecutors said their interpretation of the state's Peeping Tom law was that "upskirt" photos are illegal.
District Attorney Dan Conley said prosecutors are hoping state lawmakers will change the wording of the statute by the end of this legislative session.
"What we have is not that the Supreme Judicial Court is saying this is OK," Conley said. "The statutory language just didn't quite fit the conduct."
In its ruling, the court said that other states, including New York and Florida, have passed laws specifically criminalizing upskirt photos, noting that women have an expectation of privacy under their clothing. Washington lawmakers closed a loophole in that state's voyeurism law a decade ago, after a similar ruling there.
Conley added that this conduct has become more and more prevalent, and he urged riders to be alert.
"This action is immoral and reprehensible; don't do it," he said.
A telephone message left with Michelle Menken, Robertson's attorney, was not immediately returned.
Senate President Therese Murray said she was "stunned and disappointed" with the court ruling. She said the Senate will respond quickly.
"We have fought too hard and too long for women's rights to take the step backward," Murray said in a statement. "I am in disbelief that the courts would come to this kind of decision and outraged at what it means for women's privacy and public safety."
Gina Scaramella, executive director of the Boston Area Rape Crisis Center, said such photos are a serious invasion of privacy. She said the law needs to catch up to technology.
"It really is a form of sexual harassment. It's a violation for the person who is unknowingly getting their body photographed," she said. "People wear clothing for a reason and having someone violate that privacy is a real problem."
MBTA spokesman Joe Pesaturo said that Transit Police support the Suffolk County District Attorney's efforts to work with the Legislature in rewriting the statute. He did not say what the MBTA could do in the meantime to prevent the activity.
Pesaturo said that in the past three years, T police have investigated 13 "secretly photographing" cases. In some cases, the alleged offender was issued a court summons. Some remain open investigations. During those three years there was an average of 395 million passenger trips on the MBTA.
Associated Press writers Steve LeBlanc and Paige Sutherland contributed to this report.