NEW YORK — In the days leading up to Passover, ultra-Orthodox Jewish families maneuvered strollers through kosher markets in Brooklyn’s Borough Park neighborhood to prepare for the holiday by buying unleavened bread and wine for the Seder.

New York City officials also had Passover on their minds. A wave of measles cases has been traced to unvaccinated ultra-Orthodox children, who usually live in insular communities. When extended families get together during Passover, which begins Friday night, the chance for the disease to spread increases. And during the holiday, many families that usually keep the modern world at a distance go on public excursions.

“People will be out and about in spaces where they interact with people from the outside world,” said Meyer Labin, a writer for the Jewish publication JP News, who works down the street from the markets in Borough Park. “We’re fearful it’s going to spread."

For ultra-Orthodox Jews, Passover is an eight-day holiday bookended by festival days when they do not use electricity or drive cars. Those restrictions lift during Chol Hamoed, the four days in between, making it a popular time for families to visit parks and museums.

Only a small subset of Orthodox Jews avoid vaccinating their children. Most sects of Orthodoxy — a denomination that itself includes only 10 percent of American Jews — strongly endorse vaccination to protect public health. In many Orthodox synagogues, including Washington’s Kesher Israel and Ohev Shalom, the recent measles outbreak has prompted new policies even barring those who are unvaccinated from visiting synagogues.

Jonathan Leener, an Orthodox rabbi, said many members of his community who live in the Brooklyn neighborhood of Williamsburg, where 228 measles cases have been confirmed, are embarrassed by the attention drawn to the smaller ultra-Orthodox communities, which are generally stricter in their dress and observance.

“People are asking, ‘Is this a Jewish thing? Are the rabbis saying this?' ” he said. “It’s the opposite. Jewish law is about protecting life.”

Measles vaccinations work because of “herd immunity,” when a very high percentage of people in a given area are vaccinated, thereby protecting the community as a whole. Babies who haven’t had their vaccines yet and children and others who can’t get vaccinated for medical reasons would otherwise be at greater risk.

Mayor Bill de Blasio (D) raised the concern about Passover during a news conference this month, and Herminia Palacio, the deputy mayor for Health and Human Services, said there was an increase in measles cases in the city after the recent Jewish holiday of Purim.

The debate among rabbis isn’t about whether to vaccinate or not — most rabbis and leaders here encourage families to vaccinate their children. However, there is disagreement among some ultra-Orthodox Jews, including parents, over issues like the government’s authority in mandating vaccinations and whether Orthodox schools should ban unvaccinated students.

“This is a crisis,” said Labin, the writer for JP News. “We created an illusion that we’re secluded from the outside world, but we’re physically connected to the world. This creates a shift in an understanding that we’re part of a fabric, that we can’t not interact with people around us.”

Many in the ultra-Orthodox community see popular American culture, including television and the Internet, as corrupting, so some are less likely to listen to outside doctors and scientists on the matter, said Samuel Heilman, a sociologist who studies the Jewish community at Queens College of the City University of New York.

“The rabbis have a lot of control,” he said. “If [public officials] wanted to, they could exert more control on the issue."

Rabbis are in a difficult position, Heilman said, facing the dilemma of having to tell their congregations that city officials are being truthful on vaccines but not in other areas.

Home to one of the largest ultra-Orthodox populations in the United States, Borough Park has streets lined with synagogues, yeshivas and wig salons. Yiddish is widely spoken. Men wear tall black or fur-trimmed hats, black suits and sidelocks, and women wear long skirts and long-sleeved tops and keep their hair covered by wigs or scarves.

Ahead of Passover, which commemorates the story of Israel’s deliverance from slavery in Egypt, markets advertised Passover-friendly foods, placing plastic over sections that contain leavened foods, which are forbidden during the holiday. Customers at Eichler’s bookstore were buying books in Hebrew and plates for the Seder. A journal featuring the vaccine debate, with advocates and opponents, was selling very well, according to bookseller Yossi Friedman.

The city has mandated vaccinations in four Zip codes in Brooklyn, which has upset many in the community. In those four Zip codes, about 14 percent of children in schools are unvaccinated, city officials said this week, a percentage considered too high for good “herd immunity.” At a popular kosher ice cream shop here, one mother said the government shouldn’t have that level of control over people’s lives. “I don’t think the government should be able to tell people what to do like that,” she said. Scattering sprinkles over ice cream while sitting in a booth with padded orange seats, she said the measles are like the chickenpox, that the disease isn’t dangerous.

Nobody has died from measles in the United States since 2015, according to the Centers for Disease Control and Prevention, but some children in New York City have been admitted to the intensive care unit during this outbreak.

The city has identified 285 cases of measles since September, tracing the cases to unvaccinated children who traveled to Israel, where there is a large outbreak. Forty-nine of those cases were in Borough Park.

Most states in the United States offer an exemption for people who oppose vaccines on religious grounds, but New York is one of many states considering ending its religious exemption for mandated school age vaccines. Those who oppose vaccines in these communities often cite examples that have nothing to do with religious beliefs. There’s often a lack of trust in the government or a concern about the safety of vaccines.

Ahead of the holiday, families collected boxes of matzah and other kosher foods from Masbia Soup Kitchen. One mother in Borough Park who picked up apples there said that when her 8-year-old reacted badly to a series of shots a few years ago, she decided to stop vaccinating the younger of her nine children, who range in age from 2 to 15. The mother, who requested anonymity because she was afraid of her community’s reaction, said that she’s nervous her children could get the measles, but that she’s more nervous about vaccines.

“I grew up in Switzerland and had the measles,” she said. “They made me stronger.”

Another mother who was stacking frozen chickens in a box said her six children receive vaccines, but she prefers that they are delayed until the children are toddlers, around 3 years old. Most babies receive their first mumps, measles and rubella vaccine around 12 months.

“You can’t live in fear,” she said, declining to provide her name. “Just keep washing your hands.”

Masbia’s executive director, Alexander Rapaport, said the debate over vaccines has taken place on the fringes of his community.

“There’s a pushback mentality,” among some residents when it comes to obeying outside authorities, Rapaport said. “The Orthodox have just the same amount of crazies as other communities.”

So far this year, the U.S. has 555 cases of measles, on track to break the nation’s 2014 record nearly two decades after measles was considered “eliminated.” In 2014, the U.S. saw 667 cases, including a large outbreak in Ohio primarily among unvaccinated Amish communities. Those outbreaks reportedly led thousands of Amish to vaccinate themselves.

This year’s outbreaks in Brooklyn have caused divisions between different sects of ultra-Orthodox Jews, said Avital Chizhik-Goldschmidt, a Manhattan-based journalist who is married to an ultra-Orthodox rabbi. She usually goes to Brooklyn to run errands like getting kosher groceries but has stayed away because she has a 3-year-old son and a 1-year-old daughter.

Her children are vaccinated, but that does not completely prevent them from getting measles. Ninety-three percent of people with one dose of the measles vaccine develop immunity, and 97 percent of those with two doses do, according to the CDC. To be an Orthodox Jew is already anxiety-inducing, she said, citing fears of anti-Semitism. But the outbreaks have created tensions within the larger community.

“Almost everyone I know has rearranged their lives around this outbreak,” she said. “The fact that I’m afraid to go to places that are like a second home to me I find very upsetting.”