SACRAMENTO, Calif. — State senators passed a bill Thursday aimed at increasing California’s school immunization rates after a measles outbreak at Disneyland last year.

The bill was approved on a 25-10 vote after a series of emotional hearings this year at which opponents called for preserving parental rights on the matter.

The measure would prohibit parents from seeking vaccine exemptions for their children because of religious or personal beliefs.

The bill, which now goes to the Assembly, would make medical waivers available only for children who have health problems. Other unvaccinated children would have to be homeschooled.

“This is a matter of public safety. This is a matter of protecting our communities,” said Sen. Richard Pan, D-Sacramento.

Red-shirted opponents, some with restless children, crowded the public gallery to watch the nearly hourlong Senate debate.

If the bill becomes law, California would join Mississippi and West Virginia as the only states with such strict requirements. Gov. Jerry Brown has not said whether he would sign the bill.

Pan, a pediatrician, joined Sen. Ben Allen, D-Santa Monica, in proposing SB277 after the measles outbreak at Disneyland in December sickened more than 100 people in the U.S. and Mexico and highlighted low immunization rates in some areas of the state.

Allen said the goal is to improve immunization rates so communicable diseases don’t spread, noting that his father suffered from polio that he contracted as a child.

“People of his generation still can’t believe that we have allowed communicable diseases that we have the tools to fight back into American society,” Allen said. “This is about how each of our personal choices impacts others.”

The legislation is backed by organizations representing doctors, hospitals, teachers, public health officials, local governments and unions and by what Allen called a silent majority of parents.

Opponents unsuccessfully sought to add amendments allowing religious exemptions and making other changes.

“It tells deeply devout families that the government thinks it knows better,” said Sen. Mike Morrell, R-Rancho Cucamonga.

The vote and debate crossed party lines, with Sen. Jeff Stone, R-Temecula, endorsing the bill from his experience as a practicing pharmacist and denouncing what he said were myths that have led to false concerns.