SAN DIEGO (AP) — A federal judge will not immediately block a California law that requires all schoolchildren to be vaccinated and is one of the strictest in the nation for eliminating exemptions based on religious and personal beliefs.

The ruling Friday by U.S. District Judge Dana Sabraw in San Diego comes as the law faces its first test with the end of summer break.

A lawsuit filed by 17 families and two foundations sought an injunction while the lawsuit works its way through the courts. The law went into effect July 1 and eliminated religious and personal beliefs as reasons for opting out of the state’s mandatory immunizations.

It requires all children to be vaccinated before attending private or public schools or day care facilities unless doctors determine medical reasons for not doing so.

Sabraw wrote in his ruling that “case law makes clear that states may impose mandatory vaccination requirements without providing for religious or conscientious objections.”

He also noted it was not the court’s place to decide on the “wisdom” of the Legislature.

Attorney Jim Turner, representing the plaintiffs, said their children will not be allowed to attend school except for home schooling while the suit proceeds.

“The lawsuit could carry on for a period time, probably a year or two,” he said.

Turner said his team was still analyzing the ruling and declined to comment further.

Parents have argued that the law violated a child’s constitutional right to an education. Those who sued pointed out that 47 states allow either a religious or personal belief exemption from school vaccination mandates.

The judge wrote in his ruling that the right to an education is no more sacred than the right for a state to protect “the health and safety of its citizens, and particularly, schoolchildren.”

Lawmakers passed the legislation after a measles outbreak at Disneyland in December 2014. The outbreak sickened 147 people in the U.S., mostly in California. Under the law, kindergartners and seventh-graders must show proof of having received the government’s recommended set of vaccinations.

The state’s legal team said the plaintiffs’ claims disregard decades of scientific data and that the legislation was passed in response to a health emergency.

California “became the epicenter of a measles outbreak which was the result of unvaccinated individuals infecting vulnerable individuals, including children who are unable to receive vaccinations due to health conditions or age requirements,” the lawyers said.

The plaintiffs said that since 1961, the state has dramatically increased the number of vaccines it requires for children. They also say school districts have denied admission to children with medical exemptions.

The law’s opponents are skeptical that the risk of an adverse reaction to vaccines is minimal.