Connecticut is poised to end a long-standing religious exemption from immunization requirements for schools, a move that led to protests outside the state Capitol where people are trying to stop final legislative passage of one of the most contentious bills of the session.

The bill cleared the Democratic-controlled Senate by a vote of 22-14, following roughly nine hours of debate. Democratic Gov. Ned Lamont has said he will sign it into law. Connecticut would then become the sixth state to end its religious exemption. The state’s medical exemption would remain in place.

Proponents contend the legislation, which was amended in the House of Representatives to grandfather in any students with an existing religious exemption beginning with kindergarteners, is needed to prevent a potential outbreak. They cited a slow and steady increase in the number of religious exemptions for childhood vaccinations and declining vaccination rates in some schools.

According to the state Department of Public Health, the number of children claiming a non-medical exemption increased from 7,042 in the 2017-18 school year to 8,328 in 2019-20.

“When you see a clear pattern, it is important to be ahead of the curve and then make sure that we are able to address that,” said Sen. Saud Anwar, D-South Windsor, a medical doctor who specializes in lung diseases and treated COVID-19 patients and the vice chairman of the Public Health Committee. The vast majority of families have their children vaccinated in Connecticut.

The vote comes less than a week after the state Department of Public Health confirmed a second case of measles in a child living in Fairfield County. The same bill previously passed the House of Representatives on a 90-53, following a more than 16-hour debate.

Dr. Jody Terranova, president-elect of the Connecticut Chapter of the American Academy of Pediatrics, lauded the Senate’s action as a “proactive step to protect the health and safety of all of our residents.” But the Connecticut Freedom Alliance, a group that helped to organize a protest rally on the state Capitol grounds, called it “a terrible day for the children of Connecticut.”

State Capitol police said about 2,000 to 3,000 protesters gathered Tuesday outside for the Senate session — the second large-scale protest this session against efforts to end the exemption.

Many opponents argue the bill is unnecessary, discriminatory and an infringement on their religious liberties and parental rights. Some who gathered outside held signs with slogans such as “Defend Religious Liberty” and “Coercion is not consent,” and chanted “kill the bill.”

At times during the Senate debate, those chants and shouts from the crowd could be heard inside the marble and granite Capitol building, which is closed to the public because of COVID-19 safety protocols.

Some Republican senators on Tuesday urged their colleagues to listen to the concerns of the opponents, which include both parents with fears about vaccine safety and religious liberty advocates. Some of the bill’s opponents recently sent petitions to the senators that were signed by constituents who demanded they vote against the legislation.

“Are we not listening to the people?” asked Sen. Tony Hwang, R-Fairfield, who contends parents, not the state of Connecticut, should decide whether their child should be vaccinated. “All you need to do is look outside this building today and look at the gathering of people who have exercised their constitutional right to gather peacefully, to have their voices be heard.”

A couple Democratic senators also voiced their opposition to the bill. Sen. Cathy Osten, D-Sprague, spoke about how she refused a swine flu vaccine while serving in the military in 1977, pregnant with her daughter.

“I can’t support this bill when I had the opportunity to say no,” said Osten, who argued parents have the right to make decisions on behalf of their children.

But Anwar said compromises to the legislation were made to address concerns raised by the parents, including grandfathering those with existing exemptions and broadening eligibility for medical exemptions.

“We listened to those families and that compromise allowed us to be able to get to this point,” he said.

The legislation, which includes public and private schools, higher education, day care and child care centers, would take effect with the 2022-23 school year. If the bill becomes law, critics have said they intend to challenge it in court.