New York City on Tuesday declared a public health emergency amid a measles outbreak in the ultra-Orthodox Jewish community in Brooklyn.

Mayor Bill de Blasio said that the city would require unvaccinated individuals living in select zip codes in Williamsburg, Brooklyn, to receive the measles vaccine in response to one of the largest outbreaks in decades.

“This is the epicenter of a measles outbreak that is very, very troubling and must be dealt with immediately,” the mayor said at a news conference in Williamsburg, where he was joined by health officials.

The mayor, acknowledging it was an "unusual action," said that the city would issue violations and possibly fines for those who do not comply.

Those who cannot afford the vaccination will receive it for free, de Blasio said.

The measure comes a day after the city health department ordered yeshivas in Brooklyn to exclude from classes all students who are not vaccinated against measles or face violations and possible closure.

The outbreak started when an unvaccinated child acquired measles on a visit to Israel, where a large outbreak of the disease is occurring, according to the city health department’s website.

"Since then, there have been additional people from Brooklyn and Queens who were unvaccinated and acquired measles while in Israel," the health department said.

There have been 285 cases of the disease in Brooklyn and Queens since October, most of them involving members of the ultra-Orthodox Jewish community.

Debates in the Orthodox Jewish community over vaccinations stem from Torah teachings that followers should not cause the body any damage since it is a gift from God.

Rabbi Yehuda Shurpin, content editor for Chabad.org, wrote in a piece discussing vaccinations and Jewish law that "obviously, as in all cases, especially in regard to the health of children, one should consult one’s personal physician, a licensed medical doctor."

The piece explained that some see the small risks associated with vaccines and the risk of contracting diseases that have "been largely eliminated" as equal, and so subscribe to the Talmudic dictum that translates to “in some cases of doubt, better to sit and do nothing."

But Shurpin wrote, "One must do whatever is in their power to save oneself, one’s children, and others as well from possible life-threatening dangers."

Rabbi David Niederman, president of United Jewish Organizations of Williamsburg and North Brooklyn, told NBC News on Tuesday he is working to ensure that yeshivas fully comply with the measure.

“We are for everyone to be vaccinated," Niederman said. "From religious and civic law, we have to comply with that. There is no justification for people not to be vaccinated."

In Rockland County, New York, near the city, county health officials last month declared a state of emergency and barred unvaccinated children from public spaces for 30 days. But last week, the order was temporarily halted after a judge ruled against it.

The mayor said his main concern was getting the situation in Brooklyn under control.

"We have talked to officials and are certain this is an appropriate use of our emergency powers," de Blasio said.