New York officially ended religious exemptions for school vaccines Thursday as the state grapples with its largest measles outbreak in years.

Gov. Andrew M. Cuomo, a Democrat, signed the legislation into law Thursday evening after it passed in the state’s Senate and Assembly, ending years of gridlock over the issue.

“We’re putting science ahead of misinformation about vaccines and standing up for the rights of immunocompromised children and adults, pregnant women and infants who can’t be vaccinated through no fault of their own,” state Sen. Brad Hoylman, a Democrat, said in a statement.

The law gives unvaccinated students up to 30 days to show they’ve started their required immunizations.

All states have laws requiring various vaccines for students and all allow for medical exemptions. Many also grant parents the right to exempt their children from the vaccines for religious reasons, and a smaller number for philosophical reasons.

But the tide of public opinion has been changing as measles cases this year have already surged to the highest levels since 1992.

More than 1,000 cases of measles in at least 13 outbreaks have been diagnosed in the country this year, with the majority in New York.

The cases have largely stemmed from the ultra-Orthodox Jewish population in Brooklyn, and to a lesser extent, Rockland County, which anti-vaccine groups have had some success at targeting with misinformation. Many of these activists claim that vaccines cause autism, a link disproved repeatedly by scientists and medical experts.

Measles, a highly contagious and potentially life-threatening disease, was thought to have been eliminated in 2000, due to the success of decades-long campaigns to get people vaccinated.

Of New York’s measles cases, 74 percent have come from the Williamsburg neighborhood in Brooklyn, home to a large ultra-Orthodox population.

Opponents of the bill protested Thursday outside of New York’s capitol in Albany before the vote, claiming the legislation is an assault on religious freedom. Inside the building, some people chanted, “Shame,” after the measure passed the Assembly, while another woman shouted obscenities at lawmakers, the Associated Press reported.

“I’m not aware of anything in the Torah, the Bible, the Koran or anything else that suggests you should not get vaccinated,” Bronx Assemblyman Jeffrey Dinowitz, the Democrat who sponsored the bill, told reporters. “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.”

New York joins states such as California, Mississippi, West Virginia and Maine by outlawing nonmedical exemptions for vaccines. Several other states are deliberating whether to eliminate religious waivers for vaccines.

“The science is crystal clear: Vaccines are safe, effective and the best way to keep our children safe,” Cuomo said in a statement. “While I understand and respect freedom of religion, our first job is to protect the public health and by signing this measure into law, we will help prevent further transmissions and stop this outbreak right in its tracks.”

The bill’s passage was coupled with the news that the New York City Health Department has closed two private schools in an ultra-Orthodox neighborhood in Brooklyn for failing to comply with a recent emergency health order. The Health Department said the two schools failed to provide proof of immunity for a student at the school and allowed other unvaccinated children and staff on its site. The Health Department has closed a total of 11 schools over vaccine-related issues this year.

PARIS — All around them, the sports world has been debating whether the U.S. women’s national soccer team players ran up the score on poor Thailand and celebrated too enthusiastically as the count reached epic heights.

Inside the U.S. women’s national soccer team bubble, which encases hotels, buses and training venues across multiple French cities, things are quieter.

The players have heard and seen some of the criticism stemming from the 13-0 rout Tuesday in Reims. Immediately afterward, they answered questions about the goalfest and celebrations.

For the most part, however, they have blocked out the noise of social media, some having disconnected or reduced their online diet well before the Women’s World Cup began last week.

“It can be really consuming if you are caught up in it,” midfielder Samantha Mewis, 26, said Thursday. “A lot of us have spent less time on social media or looking at media in general. At times, there are so many positive things and you want to interact with people. I get a lot of messages from friends, but [the team is] just staying focused on our goal here, and everything else is not super important.”

The Americans drew the wrath of many fans and commentators around the globe not so much for the amount of scoring — goal differential is the first tiebreaker in group play — but for the exuberance that some players expressed when the match got out of hand in the second half. Megan Rapinoe’s twirl and slide after the ninth goal galled some observers.

Mewis and midfielder Rose Lavelle, who each scored two goals in their World Cup debuts, were the only players designated for interviews Thursday. (Wednesday was for recovery and travel, and no one was made available to comment.)

Team officials say the players have shrugged off the controversy and, with a core of experienced players, have moved onto preparations for Chile here Sunday at Parc des Princes.

Asked specifically about the backlash to the Thailand match, Mewis said: “I don’t think we are really super-involved in watching and reading a lot of media about ourselves, to be honest. But we had heard there were some things going on and we are really just trying to focus on the next game. We respect Thailand a lot and we’re just looking to the next game now.”

The Chileans, who at No. 39 in the FIFA world rankings are five slots behind Thailand, made their World Cup debut Tuesday by staying even most of the game with heavily favored Sweden before losing, 2-0.

The U.S. players arrived here Wednesday by bus after a 90-minute journey from Reims. They did not practice Thursday. With five days between matches, there is ample free time. Aside from training sessions, meetings and team meals, the players are on their own at the team hotel a bit west of the city center.

Some were planning Thursday to explore Paris, their first extended visit to the City of Light after conducting pre-Cup camp in London and then traveling to Reims.

In an effort to avoid distraction, many players have reduced online interaction.

“It’s easy to stay off our phones,” midfielder-defender Julie Ertz said last week. “This is a time for us. We’ve been preparing since 2015 [when the United States won its third World Cup trophy]. We know what we need to focus on. Anything that you feel like doesn’t keep you focused, we just try to eliminate it.”

Lavelle, 24, said since last year she has typically shut down social-media accounts when she arrives at U.S. training camps.

“I knew if I didn’t try to wean off it, it could be something that negatively affected me during this tournament,” the Washington Spirit midfielder said. “That was a work in progress, and I am really happy I did that because I can stay focused and be more present with the team.”

It’s not a complete blackout, by any means.

Forward Carli Lloyd on Thursday interacted on Twitter with the Thai goalkeeper, who had thanked the U.S. star for consoling and encouraging her after the lopsided match.

But some players last weekend seemed initially unaware of former goalkeeper Hope Solo’s critical comments about coach Jill Ellis.

“The biggest thing is just being able to come together as a group, and the best way is to kind of create that bubble and eliminate all the outside noise,” goalkeeper Alyssa Naeher said last week. “We don’t need any outside things. We have high standards. We want to win. The more we can bond, you’ll be able see that on the field. You can see the teams that are cohesive and the ones that aren’t.”