At a clinic in New York’s Rockland county on Wednesday afternoon, nurses worked to stem the state’s longest measles outbreak in two decades, one vaccination at a time.

A 30-year-old woman, originally from Israel, was one of a few dozen people who showed up at a special clinic session to get the shot – a day after the county, in the New York City commuter belt, issued a first-in-the-nation order banning children and teenagers who have not been vaccinated for measles from public places.

“It was kind of selfish not to get vaccinated, because you’re just thinking about your own health. Now that I’m an adult, I understand that people have weakened immune systems,” the woman said.

She was never vaccinated as a child because her mother opposed the vaccine – so much so that she did not tell her mom about her plans on Wednesday, and asked not to be named. “It’s more of a moral responsibility,” she said after getting the shot. “It’s more about keeping everyone else safe.”

Rockland’s emergency declaration, in effect for 30 days, bans unvaccinated children from schools, stores, restaurants, houses of worship and any other indoor places where people gather.

The move came in response to the longest measles outbreak since the disease was officially eliminated in the United States in 2000. In recent years, it has come roaring back as pockets of parents choose not to have their children vaccinated.

“We have families that are concerned and still have questions about vaccines. Otherwise, we would have 100% vaccines in the county – and we wouldn’t have a measles outbreak,” said Maria Mosquera, the medical director at the Rockland county department of health, who oversaw the free vaccine clinic at the Robert Yeager health complex in Pomona on Wednesday – the latest in an effort by authorities that has resulted in about 17,000 extra people being vaccinated since last October.

Public health experts praised the county’s moves.

“They send a really clear signal that the stakes are serious, and to vaccinate is critical. And not vaccinating has consequences. It has health consequences, and it could now have legal consequences,” said Jason Schwartz, an assistant professor of health policy at the Yale school of public health.

The anti-vaccine movement, despite a lack of support from scientists, has spread across the country, accelerated by groups on social media. There have been measles outbreaks this year in Washington, California, Illinois and Texas.

In New York, outbreaks began in Rockland county and in New York City in October after an unvaccinated child caught measles on a visit to Israel. There have since been 153 cases in Rockland, and 214 in Brooklyn and Queens.

The outbreak has been concentrated in the Orthodox Jewish community, which tends to have a lower take-up of vaccinations.

“The county has dealt professionally and diligently with this the past five months. But we’re not in the clear yet,” said Yossi Gestetner, the co-founder of the Orthodox Jewish Public Affairs Council.

But Gary Setzer, the CEO of the Jewish Federation and Foundation of Rockland county, said he feared the new rules would spur acts of antisemitism. “We believe that people need to be vaccinated and encourage them to do so. Measles is a serious illness. It is a serious problem in Rockland county,” he said.

Yet hateful messages have already circulated on social media targeting Jews in light of the measles outbreak, Setzer said, and the new rules could make it worse. “They end up being used by people who are bigots and haters as an excuse to manifest their bigotry,” he said.

Sulier Hilario, 34, with daughter Grace, five, at the Palisades Center Mall in West Nyack, Rockland county. Photograph: Lauren Aratani/The Guardian

Police do not plan actively to enforce the prohibition by checking vaccination records, Rockland officials say. But parents violating the ban could be liable for a $500 fine or up to six months in jail.

While measles cases have been clustered in the Orthodox community, it is far from unique in having pockets of resistance to vaccines.

There are dozens of unvaccinated kids at one Waldorf school in Rockland county, where parents sued to challenge an earlier rule barring some unvaccinated kids from classes.

County officials expect a legal challenge to the latest order as well, but believe they are on firm legal ground.

About 27% of residents under 18 have not been fully vaccinated, officials say. Most of the people who have contracted measles – 84% – have been minors.

“It’s not a magic wand, but it does make it more difficult for the virus to spread,” Dr William Schaffner, an infectious disease specialist at the Vanderbilt University school of medicine, said of the order.

Measles is extremely contagious – 90% of people near an infected person are likely to contract the disease if they have not been vaccinated.

“It’s a nasty, nasty infection,” Schaffner said.

At the Palisades Center Mall in Rockland county on Wednesday, Sulier Hilario, 34, was shopping with his daughter, Grace, five, who he said had been vaccinated against measles.

“I don’t want her getting sick. That’s my main priority,” Hilario said. He said he supported the county order and urged other parents to get their children vaccinated.

I just don’t understand why people aren’t doing it. But if you’re not doing it, it’s your kid. I just don’t want them harming my kid,” he said.