Updated

New York eliminated the religious exemption to vaccine requirements for schoolchildren Thursday, as the nation's worst measles outbreak in decades prompts states to reconsider giving parents ways to opt out of immunization rules.

The Democrat-led Senate and Assembly voted Thursday to repeal the exemption, which allows parents to cite religious beliefs to forego getting their child the vaccines required for school enrollment.

Gov. Andrew Cuomo, a Democrat, signed the measure minutes after the final vote. The law takes effect immediately but will give unvaccinated students up to 30 days after they enter a school to show they've had the first dose of each required immunization.

With New York's move, similar exemptions are still allowed in 45 states, though lawmakers in several of them have introduced their own legislation to eliminate the waiver.

The issue is hotly contested and debate around it has often been emotional, pitting cries that religious freedom is being curtailed against warnings that public health is being endangered. After the vote in the Assembly, many of those watching from the gallery erupted in cries of "shame!" One woman yelled obscenities down to the lawmakers below.

The debate has only intensified with this year's measles outbreak , which federal officials recently said has surpassed 1,000 illnesses, the highest in 27 years.

"I'm not aware of anything in the Torah, the Bible, the Koran or anything else that suggests you should not get vaccinated," said Bronx Democrat Jeffrey Dinowitz, the bill's Assembly sponsor. "If you choose to not vaccinate your child, therefore potentially endangering other children ... then you're the one choosing not to send your children to school."

Hundreds of parents of unvaccinated children gathered at New York's Capitol for the vote to protest.

Stan Yung, a Long Island attorney and father, said his Russian Orthodox religious views and health concerns about vaccines will prevent him from vaccinating his three young children. His family, he said, may consider leaving the state.

"People came to this country to get away from exactly this kind of stuff," Yung said ahead of Thursday's votes.

Supporters of the bill say religious beliefs about vaccines shouldn't eclipse scientific evidence that they work, noting the U.S. Supreme Court ruled in 1905 that states have the right to enforce compulsory vaccination laws. During the Assembly's floor debate, supporters brought up scourges of the past that were defeated in the U.S. through vaccines.

"I'm old enough to have been around when polio was a real threat," said Assemblywoman Deborah Glick, D-Manhattan. "I believe in science.... Your personal opinions, which may be based on junk science, do not trump the greater good."

Supporters also suggest some parents may be claiming the religious exemption for their children even though their opposition is actually based on scientifically discredited claims about the dangers of vaccines.

The bill would not change an existing state exemption given to children who cannot have vaccines for medical reasons, such as a weakened immune system.

Cuomo told reporters on Wednesday that he believes public health — and the need to protect those who cannot get vaccinated because for medical reasons — outweighs the concerns about religious freedom.

"I understand freedom of religion," he said. "I have heard the anti-vaxxers' theory, but I believe both are overwhelmed by the public health risk."

The current measles outbreak has renewed concern about the exemptions in many states. The nation last saw as many cases in 1992, when more than 2,200 were reported.

The majority of cases are from outbreaks in New York in Orthodox Jewish communities.

California removed personal belief vaccine exemptions for children in both public and private schools in 2015, after a measles outbreak at Disneyland sickened 147 people and spread across the U.S. and into Canada. Maine ended its religious exemption earlier this year.

Mississippi and West Virginia also do not allow religious exemptions.

Once common in the U.S., measles became rare after vaccination campaigns that started in the 1960s. A decade ago, there were fewer than 100 cases a year.