Shawnee Anderson couldn’t stop crying. On the morning of Jan. 24 last year, she sat in the front seat of a red minivan parked outside her home in Napa, California, with her 11-month-old son in her lap. Roughly 20 minutes earlier, police had arrived at the one-story house, summoned by a neighbor who’d called to complain about a loud argument between Anderson and her boyfriend, Aaron Hillyer.

The couple explained that because they were low on sleep and stressed about Anderson’s first day back at work, a disagreement over who would change their child’s diaper had escalated. “This whole argument is ridiculous,” Anderson told the officers, shaking her head no when they asked if the fight had become physical.

But now Hillyer was in handcuffs and police were saying that both he and Anderson would be charged with felony child endangerment. The officers had found prescription marijuana packets, pipes and burnt joints on tables in the living room and the couple’s bedroom. Anderson and Hillyer explained that they were licensed users under California’s 19-year-old medical marijuana law, but the cops said the couple had put their son, Sage, at risk by careless use of the substance at home. “Your baby doesn’t need to be subjected to marijuana,” one of the officers can be seen saying in a video of the incident.

The couple spent five days in jail, Sage spent nearly two weeks in foster care, and for the next 13 months Anderson and Hillyer fought a juvenile court’s ruling that they’d mistreated their child. Though they had their son back, the government had official jurisdiction over Sage and was entitled to make any decisions it deemed in the interest of the child, including removing him from his parents’ care.

As marijuana laws loosen across the country, there’s a growing gap between what’s legal and what raises red flags for child-protection agencies. Twenty-three states and Washington, DC, have approved medical marijuana programs, and of those, four states and the capital have legalized the drug for recreational use. No nationwide data exist on how many parents have faced neglect and abuse investigations over their marijuana use, as many child-welfare agencies don’t track how many cases involve drugs, much less the type of substance. But the Family Law & Cannabis Alliance, a Massachusetts-based group formed in 2013 to help parents in marijuana-related child-welfare and custody disputes, says it assisted 200 families nationwide last year. Public defenders in Colorado and New York who represent clients in family and juvenile court say as many as one-sixth of their cases involve marijuana, although use of the drug is usually just one of several allegations against parents. Government intervention can result in regular drug testing; findings of neglect, which can impede a parent’s ability to find work around young people; the child’s placement in foster care; and, in rare cases, termination of parental rights.

Critics say the approach of child-protection agencies and juvenile courts is often outdated, characterized by overzealous enforcement from the war on drugs era and beliefs about the risks of marijuana that aren’t supported by science. Meanwhile, low-income families of color are more likely to face neglect charges involving pot, as they tend to live in more heavily policed neighborhoods and give birth in hospitals that may be more likely to conduct drug testing on newborns.

“While we’ve had a sort of national rethinking of marijuana laws, it has not filtered down to family court,” says Carl Hart, an associate professor of psychology at Columbia University who studies drug abuse. “It’s a simple fix to look at the behavior of the child, of the parent and not what’s in their urine.”

Officials with state child-protection agencies say that parental marijuana use, whether legal or illegal, would not alone qualify as child abuse or neglect. But they argue that pot use can impair a person’s ability to parent and pose safety risks to a child. Michael Weston, a spokesman for California’s Department of Social Services, declined to comment on specific cases. He said, however, that a caseworker entering a home is looking for all sorts of causes of concern — and that could include bottles of aspirin, of bleach, of illegal drugs or legal marijuana, if they are accessible to children.