(CNN) -- Massachusetts' highest court ruled Wednesday that it is not illegal to secretly photograph underneath a person's clothing -- a practice known as "upskirting" -- prompting one prosecutor to call for a revision of state law.
The high court ruled that the practice did not violate the law because the women who were photographed while riding Boston public transportation were not nude or partially nude.
"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," wrote Justice Margot Botsford of the state Supreme Judicial Court.
CNN legal analyst Sunny Hostin said the law has not caught up to technology and called it an assault on a woman's right to privacy.
"I think the courts got it wrong," Hostin said. "The spirit of the law makes it clear it is about the person's privacy."
The ruling stems from the case against Michael Robertson, 32, who was arrested in 2010 and accused of using his cell phone to take pictures and record video up the skirts and dresses of women on the trolley, according to court documents.
Two separate complaints were filed against Robertson with the transit police. Authorities then staged "a decoy operation" to catch Robertson, who was eventually arrested and charged with two counts of attempting to secretly photograph a person in a state of partial nudity. Police observed him point a cell phone video camera up the dress of a female officer, court documents state.
Wednesday's ruling reversed a previous decision by a lower court, which had denied a motion by Robertson seeking the dismissal of the case, said a statement from the Suffolk County district attorney's office.
"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," the high court ruled.
The ruling that 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."
Prosecutors had argued that the current statute, which prohibits secretly photographing or videotaping a person who is "nude or partially nude," includes upskirting, according to documents.
But Robertson's lawyers argued that the female passenger on the trolley was not "nude or partially nude" and was not in a place where she had a reasonable expectation of privacy, according to court documents.
"Every person, male or female, has a right to privacy beneath his or her own clothing," Suffolk County District Attorney Daniel Conley said in a statement Wednesday. "If the statute as written doesn't protect that privacy, then I'm urging the Legislature to act rapidly and adjust it so it does."
Robertson's lawyer, Michelle Menken, did not return a phone call seeking comment.
Robertson faced misdemeanor charges punishable by up to two and half years in prison.