Children whose parents opt them out of vaccines on religious grounds can be barred from New York City’s public schools if the child poses a threat to another pupil, a federal judge has ruled.

U.S. District Judge William F. Kuntz II found that education officials can send unvaccinated children home when another student suffers from a vaccine-preventable disease.Three families had challenged the city’s policy, arguing that it unconstitutionally violated their freedom of religious expression. It’s a complex case: According to The New York Times, two families sued to overturn the city’s policy, while a third plaintiff sued over the city’s refusal to grant her the religious exemption she sought.“We don’t want anything being put into our bodies at all,” said Nicole Phillips, mother of two unvaccinated children, after filing suit in 2012. “We’d rather rely on our natural immune system and our faith in God. This is about my children’s rights.”And Dina Check argued that the city’s requirements to qualify for a religious exemption also violated her constitutional rights. She believes her daughter was “intoxicated” after receiving some vaccines as an infant and subsequently sought an exemption from the rest of the vaccine schedule.

“Disease is pestilence,” Check told The Times, “And pestilence is from the devil. The devil is germs and disease, which is cancer and any of those things that can take you down. But if you trust in the Lord, these things cannot come near you.”But Kuntz rejected those arguments, citing a 109 year-old Supreme Court case that upheld a $5 fine for a Massachusetts man who refused a smallpox vaccine during an epidemic.That case, Kuntz wrote, is evidence that the Court “strongly suggested that religious objectors are not constitutionally exempt from vaccinations.”

New York City’s government, Kuntz said, has a compelling interest to protect public health and that outweighs the right of religious objectors to send their unvaccinated children to public schools, where they might possibly endanger others.There’s also evidence that the city’s policy has successfully curbed at least one measles outbreak. The Times reports that between February and April this year, 25 people contracted measles, a vaccine-preventable disease. Two were children whose parents exempted them from vaccines for religious reasons. Although one child was being homeschooled, a sibling attended public school. Officials say the outbreak would have been much worse if the infected children hadn’t been ordered to stay home.  But the families who filed suit over the city’s policy are undeterred by the health policy’s evident success – and by Kuntz’s ruling. Their attorney, Patricia Finn, announced that they intend to appeal.This ruling provides a valuable example of reasonable restrictions on religious freedom. Families are legally entitled to believe whatever they choose about medicine, including vaccines, and this ruling doesn't require them to vaccinate. But they also aren’t entitled to jeopardize public health.

Sweeping religious freedom claims have been making national headlines for months now. This decision is a reminder that, as important as religious liberty is in America, it can be curtailed in the face of a compelling state interest. Halting the spread of dangerous diseases most certainly qualifies as a compelling interest.

New York City’s policy strikes a balance between protecting religion and safeguarding public health. Despite what the plaintiffs have claimed, it’s hardly a draconian assault on their religious freedom. In fact, the city’s policy is actually rather lenient compared to those in some other locales. In Mississippi and West Virginia – states not known as bastions of secular liberalism – it’s impossible to receive such an exemption at all. And neither state seems likely to change policy any time soon.Whether it’s a parent trying to send an unvaccinated child to public school during an epidemic or an employer is trying to deny contraception coverage to his employees, religious freedom is never a valid excuse for infringing the rights of other people.