LOWELL -- A District Court judge has narrowly rejected a motion to dismiss charges against a Foxboro man accused of trying to use his camera to take "upskirting" photos of a 12-year-old girl at the Southeast Asian Water Festival in Lowell last year.

After hearing arguments from both sides Tuesday, Lowell District Court Judge Barbara Pearson sided with prosecutor Phil Cheng, saying there is enough probable cause to sustain the charges of accosting/annoying a person of the opposite sex and disturbing the peace against Thomas Frederick Withers, 58.

Defense attorney Thomas F. Natoli, representing Withers, argued that the allegations against Withers didn't meet the elements of either charge.

Prosecutors allege that during the festival along the VFW Parkway in August, a girl, 18, and her sister, 12, were walking on top of a stone wall when they were approached by Withers. He was asking them questions about the boats when the father of the young girl allegedly saw Withers place his camera under the 12-year-old daughter's skirt, prosecutors allege.

The father stopped Withers before he could take a photo and held the suspect until the police arrived, prosecutors allege.

Natoli argued the father may have been aware of the alleged upskirting, but the daughter, who is the alleged victim, was not aware, so Natoli says the accost/annoy charge, along with the disorderly conduct charge, should be dismissed.

Pearson warned Cheng that prosecutors need to interview the victim again before trial to determine if she was aware Withers was allegedly trying to take photos of her. At trial, prosecutors need to meet the "beyond a reasonable doubt'' standard for a conviction of accost/annoy a person of the opposite sex.

Pearson scheduled a May 6 court date to allow prosecutors time to contact the alleged victim to see if the case can go forward.

At an earlier hearing, prosecutors dropped a charge of posing/exhibiting a child in a sex act after an analysis of Withers' camera showed no such photos.

Cheng noted that while Withers' case appears similar to the Michael Robertson case that triggered a controversial ruling by the state's highest court, it is not.

Last month, the state Supreme Judicial Court ruled in the Robertson case that it is not illegal to secretly photograph underneath a person's clothing -- a practice known as "upskirting" -- because the person is not "partially nude'' as described in the statute.

The ruling stems from the case against Robertson, 32, who was arrested in 2010 and accused of using his cellphone to take pictures and record video up the skirts and dresses of women on the trolley, according to court documents.

Within days of the ruling, the state Legislature enacted a law making "upskirting'' illegal.

But Cheng noted the SJC was addressing the only charge Robertson faced, which was posing/exhibiting a child in a sex act. Charges of disorderly conduct and annoy/accost a person of the opposite sex had already been dismissed against Robertson.

The Withers case is "the opposite,'' Cheng said.

Withers is currently free on a GPS-monitoring bracelet with a curfew and conditions that he not use a camera, and he must avoid any unsupervised contact with anyone younger than 16.

Follow Lisa Redmond on Tout and Twitter@lredmond13_lisa.