A certified medical assistant fills a needle in Corpus Christi, Tex., on May 27, 2016. (Matthew Busch/For The Washington Post)

Linda C. Fentiman is a professor at the Elisabeth Haub Law School at Pace University and author of the new book “Blaming Mothers: American Law and the Risks to Children’s Health.”

Public health experts once again must defend the safety — and necessity — of vaccination, this time in response to misinformation spread among the Somali community in Minnesota by anti-vaccine activists.

The rising skepticism about vaccines is dangerous on its own, of course. Last year, a study in the journal Pediatrics found that more parents than ever believe vaccines are simply unnecessary to prevent childhood diseases. But the anti-vaccine movement highlights another, troubling aspect in the world of child health: Wealthy people are more likely to be let off easy when they do things that can harm their children than low-income people are.

Parents in affluent communities enjoy a privileged status under the law that manifests most clearly — and most dangerously — when they refuse to have their children vaccinated. These parents are vaccination “free-riders” who are not held legally accountable for putting their own children — as well as other people’s children — at risk of potentially fatal childhood diseases.

Take a look at where the highest rates of vaccine exemptions cluster and you quickly begin to see a pattern: These are relatively affluent enclaves, including suburban Marin County, Calif., and wealthy areas of Chicago, Los Angeles and Manhattan.

In fact, many state legislatures changed their laws to accommodate these parents, often on First Amendment or due-process grounds. Eighteen states permit parents to refuse vaccination on the basis of personal beliefs; 47 states permit parents to “opt out” based on their religious beliefs. Indeed, so many parents have succeeded in opting out of vaccination that in many communities across the country, the rates of immunization have fallen to record lows, threatening to undercut the dramatic advances in children’s health made possible by the vaccine revolution of the 20th century.

This extraordinary deference is being paid even as prosecutors around the nation have ramped up the severity of charges they are using to prosecute pregnant women and mothers — particularly those on the lower end of the socioeconomic scale — for other behaviors seen as risking the health of their children.

Women have often been prosecuted for behavior while pregnant including for using drugs, for refusing to have a cesarean section or even for having an accident. Some poor women have faced criminal charges for choosing to breastfeed their infants — for failing to deliver adequate nutrition, delivering drugs via their breast milk or just for having two beers at dinner while nursing. Other mothers have faced criminal charges for child abuse “by omission,” based on a failure to protect their children from an abusive partner.

Take, for example, the prosecution of Regina McKnight in South Carolina.

McKnight, a young, homeless and mentally impaired African American woman, delivered a stillborn baby in 1999 after using cocaine while pregnant. In many cases, the cause of a stillbirth is unknown and the science on the effect of illegal drugs on a developing fetus is far from conclusive. Nonetheless, prosecutors successfully convinced a jury that McKnight was guilty of murder based on her drug use. The trial judge sentenced her to 20 years in prison, and the conviction was affirmed by the South Carolina Supreme Court.

The McKnight case seems to have inspired zealous prosecutors across the country. In 2004, for example, Utah prosecutors charged Melissa Rowland with first-degree murder after she declined a C-section and later delivered a stillborn son; only after public outcry did the prosecutor reduce the charges to child endangerment. And in 2013, Alicia Beltran — a 28-year-old pregnant woman from Wisconsin who had weaned herself off a prescription painkiller addiction — was arrested after acknowledging her drug use at a prenatal visit. She spent 78 days in involuntary confinement before being released.

It would be comforting to believe that American law takes no notice of class, gender and race, but this prosecutorial disparity makes it all too clear that these factors still play an important role in how people are treated. Wealthy mothers who endanger their children and the larger community because of misguided beliefs about vaccination get a pass, while poorer women are expected to shield their children regardless of the structural obstacles arrayed against them. When these mothers fail to do so, the law does not give them the benefit of the doubt.

This double standard in protecting children must end. All parents — regardless of socioeconomic status — must accept the responsibility for children’s health and safety as a collective obligation. That includes safeguarding children from abuse, but it also includes a duty to vaccinate for the public’s health. Citizens should demand that state governments tighten their requirements for vaccination and enact laws based on solid science and the need to protect the community at large.

The government’s inaction on vaccination stands in stark contrast to the charges brought against poorer mothers in other circumstances. These women face overly punitive measures even when it is unclear that they are responsible for the harm suffered by their children. Yet affluent mothers often have no such worries, even when they expose their children and the community to indisputable danger.

The science on the efficacy and safety of vaccines is clear. So is the message sent by the law’s prosecution of some mothers and not others.