The Trump administration’s apparent policy of separating parents and children entering the U.S. without papers—even those seeking asylum—has drawn criticism, and rightly so: It’s transparently cruel and essentially disconnected from any public safety or child welfare purpose. A district court judge has also said such a policy, if it did exist, would be a clear and “brutal” constitutional violation. It’s also a breathtaking departure from the procedural norms that the U.S. legal system has developed over decades for removing children from their parents—a process that state courts treat with a constitutional seriousness akin to criminal cases. As a public defender in Connecticut, I’ve represented parents and children in neglect and abuse cases for almost 10 years, and while the system is far from perfect, the prevailing understanding among all participants—judges, parents’ and children’s lawyers, and the state child welfare agency—is that family separation is the last resort.

Aside from the few standout cases that make the news, we seldom hear about child-removal proceedings, which take place behind closed doors and affect almost exclusively the very poorest among us. But it’s worth looking at how the system works to understand just how extraordinary the government’s current actions have been in these cases.

As long ago as 1923, the Supreme Court recognized the right to have and raise children as a fundamental liberty. Since at least 1972, courts have recognized both parents’ and children’s rights to family integrity as constitutional—not to be trampled absent a compelling government justification. Although the U.S. Supreme Court has held that parents are not entitled to a lawyer in all child-removal proceedings, every state but Mississippi provides free counsel to indigent parents. Appellate courts often note that termination of parental rights has been called the civil equivalent of the death penalty.

As a practical matter, courts presume that family separation should not occur, and child welfare agencies have the burden of proving that it’s absolutely necessary. In every state, the agency can remove a kid in an emergency but has to get a judge to sign off within a short time (in Connecticut, it’s four days), and the parents get a trial with a lawyer soon after (usually in less than a month). At that trial, the agency has to prove that the child is in immediate risk of serious physical harm. In the courts where I practice, it’s not uncommon for the agency to fail to meet this burden. Even when the burden is met, a parent can go back to court soon afterward and argue that the risk is no longer serious enough to warrant continued separation.

As a practical matter, courts presume that family separation should not occur.

When children are removed, states are required in all but the most severe cases to work toward family reunification, and the resources they expend on this can be extensive: Parents get visits, mental health care, housing assistance, job training, transportation vouchers, and more. Although those of us who represent parents often have to fight for it, it’s not unheard of for state agencies to buy furniture for our parent clients, to help them with apartment security deposits, and to fly them from other states for visits. These efforts can go on for two years or more. Among parents I’ve seen reunited with their kids were a father who broke his son’s leg by throwing him down in anger, a mother who ran over someone on purpose with her kids in the car, and more people addicted to heroin than I can recall. The legal standard for parents in child-protection matters is “minimally adequate.” In other words, if a court has to choose between leaving a child in a comfortable, loving foster home or returning her to an impoverished, barely capable parent, the parent wins. Even a perfect grandparent is presumed less suitable than a deeply flawed—but not dangerous—parent. Appellate courts around the country have ruled again and again that it is inappropriate even to make comparisons between parents and nonparents based on material resources.

These rules aren’t just judicially created mechanisms to discourage needless family separation, the way the suppression of evidence discourages illegal police searches. They rest on years of experience and research showing that parent-child relationships—even those marked by neglect or abuse—are hard to replace, and family separation is inherently traumatic. Foster care is, at best, a necessary evil that yields long-term outcomes no better than if kids stayed home. I have seldom represented a child beyond infancy who hasn’t developed new behavioral problems when separated from her parents, and it’s common for teenagers to try to run away from foster care to reunite with their parents, no matter the circumstances that led to their removal in the first place.

In this context, the federal government’s family-separation policy is astounding. It affords immigrant parents, most of whom aren’t accused of any child-rearing failure, less visitation and fewer procedural rights than parents accused of serious physical abuse, parents with chronic mental health and substance abuse problems, and parents facing serious criminal charges. It treats immigrant children as an afterthought. The system I work in is woefully imperfect, but it endeavors to be nonpunitive, to make children’s needs paramount, and to consider the fundamental rights of parents. The government’s treatment of immigrant families seems designed to do the opposite.