Kudos to the Legislature and Gov. Cuomo for doing the right thing on vaccines.

It was touch-and-go: The bill to end the “religious exemption” from laws mandating basic public-health vaccinations almost died in committee. But Assemblyman Nader Sayegh (D-W’chester) courageously changed his vote to let the measure move to the floor.

The current measles outbreak has seen more than 800 cases in New York City and Rockland County, largely in Orthodox Jewish communities — where pseudoscientific fears about side effects from vaccination have somehow proliferated.

Even though both the Orthodox Union and the Rabbinical Council of America support vaccinating children against measles, mumps, rubella, polio and the other childhood diseases. That’s a key sign that those refusing to get their kids vaccinated weren’t actually doing it for religious reasons.

Notably, California ended a similar religious exemption in 2015, and that has withstood court challenges since.

Yet the New York bill seemed stalled until last week, when the Siena poll found that an overwhelming proportion of New Yorkers support mandatory vaccinations — 84 percent in favor, just 13 percent opposed.

Whatever the reason for action, it’s good to see the Legislature serving the public wisely on at least one issue.