The state’s highest court ruled today MBTA passengers have no expectation of privacy from “upskirting,” as the criminal case against a man accused of trying to sneak cellphone photos of female passengers up their skirts was ordered dismissed by a lower court.

Supreme Judicial Court justices concluded that a state law that prohibits photographing an unsuspecting nude or partially nude person “is concerned with proscribing Peeping Tom voyeurism of people who are completely or partially undressed and, in particular, such voyeurism enhanced by electronic devices.”

The law, they found, “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.

“In sum, we interpret the phrase, ‘a person who is … partially nude’ in the same way that the defendant does, namely, to mean a person who is partially clothed, but who has one or more of the private parts of body exposed in plain view at the time that the putative defendant secretly photographs her. 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 ruled.

Michael S. Robertson, 32, of Andover, was facing more than two years in jail had he been convicted. He could not immediately be reached for comment, but the SJC’s decision sparked calls for updating the law.

“We believed that the statute criminalized upskirt photography, but since the SJC found otherwise we are urging legislators to act with all due haste in rewriting this statute in protecting commuters’ privacy,” Suffolk District Attorney Daniel Conley said. “Everyone — man or woman — should have a right to privacy beneath their own clothes.”

T spokesman Joe Pesaturo said, “MBTA Transit Police support the Suffolk DA’s efforts to work with the Legislature in rewriting the statute.”

Robertson was arrested in 2010 for allegedly using his cellphone to try and take pictures up the skirts of a T passenger and an undercover transit cop.

His appellate lawyer Michelle Menken argued in her brief, “In light of the ubiquitous nature of cell phone cameras in today’s society, and the ease with which digital images are disseminated worldwide, the Legislature may choose to criminalize up-skirting … But this court is not free to give new meaning to the existing statute as a consequence of the changing times.”

Robertson’s case in Boston Municipal Court was stayed pending the SJC’s ruling.