The judge sided with municipal health officials who defended the order as a rare but necessary step to contain a surge in the highly contagious disease that has infected at least 329 people so far, most of them children from Orthodox Jewish communities in the borough of Brooklyn.

In a six-page decision rendered hours after a hearing on the matter, Judge Lawrence Knipel denied the parents' petition seeking to lift the vaccination order, imposed last week to stem the worst measles outbreak to hit the city since 1991.

A Brooklyn judge on Thursday ruled against a group of parents who challenged New York City's recently imposed mandatory measles vaccination order, rejecting their arguments that the city's public health authority exceeded its authority.

Another 222 cases have been diagnosed elsewhere in New York state, mostly in a predominantly ultra-Orthodox Jewish neighborhood of Rockland County, northwest of Manhattan.

The New York outbreaks are part of a larger resurgence of measles across the country, with at least 555 cases confirmed in 20 states, according to the U.S. Centers for Disease Control and Prevention.

Health experts say the virus, which can cause severe complications and even death, has spread mostly among school-age children whose parents declined to get them vaccinated. Most profess philosophical or religious reasons or cite concerns - debunked by medical science - that the three-way measles-mumps-rubella (MMR) vaccine may cause autism.

The judge rejected the parents' contention that the vaccination order was excessive or coercive, noting that it does not call for forcibly administering the vaccine to those who refuse it.

Under the public health emergency declared last Tuesday by Mayor Bill de Blasio, residents of certain affected Brooklyn neighborhoods who refuse orders to obtain an MMR vaccine face fines unless they can otherwise demonstrate immunity to measles or provide a valid medical exemption.

The court challenge was filed in Brooklyn's Supreme Court on behalf of five mothers and their children in the affected neighborhoods. Their identities were kept confidential to protect the children's privacy, their lawyers said.

They told Knipel in court on Thursday the city had overstepped its authority and that quarantining the infected would be a preferable approach.

Robert Krakow, an attorney for the parents, estimated that just 0.0006 percent of the population of Brooklyn and Queens had measles. "That's not an epidemic," he said. "It's not Ebola. It's not smallpox."

The health department's lawyers argued that quarantining was ineffective because people carrying the virus can be contagious before symptoms appear.

The judge cited 39 cases diagnosed in Michigan that have been traced to an individual traveling from the Williamsburg community at the epicenter of Brooklyn's outbreak. The surge in measles there originated with an unvaccinated child who became infected on a visit to Israel, where the highly contagious virus is also running rampant.

Krakow later told Reuters he was reviewing the judge's dismissal of the case - brought under special proceedings for the appeal of administrative actions - to determine how his clients might respond.

The number of measles cases worldwide nearly quadrupled in the first quarter of 2019 to 112,163 compared with the same period last year, the World Health Organization said this week.