Massachusetts lawmakers approved a bill Thursday to ban those who secretly take 'upskirt' photographs of women or children in public.

The bill comes one day after the state Supreme Court ruled that a man who took cellphone photos up the skirts of female passengers riding the Boston subway didn't violate state law, because the women were clothed.

"It is sexual harassment. It's an assault on another person whether it's a child or an adult," Senate President Therese Murray said moments after the Senate unanimously approved the bill. "Woman and children should be able to go to public places without feeling that they are not protected by the law."

The Supreme Judicial Court on Wednesday overturned a lower court's ruling against Michael Robinson, 31, of Andover, who was arrested in August 2010 by Massachusetts Bay Transportation Authority (MBTA) police for allegedly using his cellphone to take pictures up women's skirts. In an eight-page ruling, Justice Margot Botsford wrote that a female passenger wearing a skirt or dress is “not a person who is ‘partially nude,’” referring to so-called Peeping Tom laws protecting people from being photographed or recorded when nude or partially nude.

Jake Wark, a spokesman for the Suffolk County District Attorney’s Office, told FoxNews.com that 13 people, or a “fairly limited” number of suspects, have been investigated for or charged since 2011 with the crime under Ch. 272, Sect. 105(b) of the Massachusetts General Laws.

“It’s not a very widespread offense, fortunately,” Wark said, citing MBTA statistics.

After the ruling, anyone convicted of such an offense could now mount an appeal, and those whose cases are pending could see them dismissed, Wark said. It was unclear how many relevant cases are now before the courts, but such charges typically take up to two years to be resolved, Wark said.

“Our position remains that every person has a right to privacy underneath their own clothing,” Wark said.

Keri Rodrigues Lorenzo, vice president of the Massachusetts chapter of the National Organization for Women, told FoxNews.com that the organization was “very disappointed” by the ruling, which she said could mean more female riders could be victimized on trains.

“The idea that women are allowed to be subject to such a predatory intrusion and incredibly gross violation of privacy for simply having the audacity to wear a common item of clothing while riding public transportation in Massachusetts is outrageous,” Lorenzo wrote in a statement. “We look forward to working with our Legislators in the General Court to ensure that this loophole immediately is closed and women in Massachusetts will no longer be subjected to such an unbelievable intrusion for the crime of riding the T while wearing a skirt.”

In the 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. Legislators in Washington, meanwhile, closed a loophole in the state's voyeurism law a decade ago following a similar ruling there.

Some Massachusetts residents said they were shocked by the ruling, while others understood the legal gray area.

“It’s like sexual harassment,” Burton Morris, 27, of Hyannis, told CapeCodOnline.com. “Looking up a skirt is sexual harassment.”

Jason Nitti, of Harwich, disagreed, saying he realized it presented a “conundrum” if read closely.

“It’s odd because you’re in a public area,” Nitti told the newspaper. “Sometimes law and morality don’t coexist.”

The Associated Press contributed to this report.