Connecticut will no longer allow a religious exemption from childhood immunization requirements for schools, colleges and day care facilities, becoming the sixth state to end that policy.

The legislation was signed into law Wednesday by Gov. Ned Lamont, hours after the Democratic-controlled Senate passed the bill late Tuesday night. More than 2,000 opponents had rallied outside the state Capitol building, arguing the legislation unfairly infringes on their religious liberties and parental rights.

“Proud to sign this bill into law to protect as many of our school children as possible from infectious diseases as we can,” Lamont said in a tweet, announcing he had signed the contentious bill.

Shortly afterward, two groups opposing the legislation — We The Patriots USA, Inc. and The CT Freedom Alliance, LLC. — said they plan to file state and federal lawsuits seeking to overturn the new law, which will take effect with the 2022-23 school year.

“The notion that somehow the state government gets the right to cram its version of virtue down the throats of every citizen in this state is and ought to be offensive to every Connecticut resident,” said Norm Pattis, an attorney representing the organizations. He called it “far more chilling” to tell a parent how to raise their child than to expose other children to a “nominal risk” of infection, given the state’s high, overall vaccination rate.

The other states without religious exemptions for vaccines are California, New York, West Virginia, Mississippi and Maine, according to the National Conference of State Legislatures.

Under Connecticut’s new law, which applies to public and private schools, higher education, day care and child care centers, any students in kindergarten and older with an existing religious exemption will be grandfathered. Also, the state’s medical exemption will remain in place.

Proponents have argued that eliminating the exemption will help prevent potential outbreaks of illnesses like measles. They cited a slow and steady increase in the number of religious exemptions for childhood vaccinations and declining vaccination rates in some particular schools.

“The exemption has been used in recent years to skirt the vaccine law, causing many schools to fall below the Centers for Disease Control and Prevention’s threshold of 95% needed for herd immunity against highly contagious diseases like Measles, Pertussis, Tetanus, and Meningitis, among others,” the Vaccination Alliance of Connecticut, a coalition of public health officials, parents and others, said in a written statement.

Vaccines are encouraged, or in this case required, because they have been proven safe and protect not only those vaccinated but also others who can’t be by slowing the spread of preventable diseases.

But critics, which include both parents with fears about vaccine safety and religious liberty advocates, argue the bill is unnecessary given the state’s overall high vaccination rate and discriminatory, forcing parents with religious concerns about vaccines to ultimately home-school their children.

“Don’t ever consider yourself a champion of children. You failed our kids by voting yes on #HB6423. You are denying services to special needs kids. You are forcing families out of the workforce,” The CT Freedom Alliance tweeted at Lamont and state legislators who voted for the bill, also calling Lamont a “tyrant.”

Lamont said he spent a lot of time researching the issue.

“When it comes to the safety of our children, we need to take an abundance of caution,” he said in a statement. “This legislation is needed to protect our kids against serious illnesses that have been well-controlled for many decades, such as measles, tuberculosis, and whooping cough, but have reemerged.”