THE THEORY behind foster care is grounded in an assumption of stability — placing children whose parents are absent, dead or deemed unfit with stable families where community, schools and peers are roughly familiar. The reality is increasingly the opposite.

An acute shortage of foster parents has produced a cohort of vulnerable children, many with drug-addicted parents, who are sent away, sometimes out of state, to live in juvenile detention centers, shelters and group homes. In those inhospitable institutions, where some guiltless teenagers grow up behind barbed wire and in the company of convicted criminals, their chances of thriving are scant.

An eye-opening report by The Post’s Emily Wax-Thibodeaux laid bare the life-shattering harm suffered by such children in states that have not or cannot provide adequate foster care. The psychological and emotional damage may be insurmountable for many of them.

The Family First Prevention Services Act, enacted by Congress in 2018 partly in response to the crisis, may help. It shifts federal funding to programs intended to help keep children with struggling parents, beefing up services such as substance-abuse treatment, mental-health care and parenting skills training. But much of the money will not start flowing until next year, and the hoped-for improvements may take much longer than that.

Long-term institutional settings are bad for children. Orphanages, where many were once warehoused, were phased out after World War II. But in states such as West Virginia, where 7 in 10 children in the foster care system live in group homes, detention centers and residential treatment facilities, those placements may be little better than orphanages.

The reality in many states is that policy makers face a menu of poor choices. Research by the Annie E. Casey Foundation suggests that congregate care — the term for such group settings — results in children with more mental-health problems, higher high school drop-out rates and a greater likelihood to commit crimes. But an earlier study of three Midwestern states’ foster care systems by the University of Chicago, in which two-thirds of the sampled children had lived with foster parents or relatives who served as foster parents, also showed discouraging outcomes: By age 17, more than half were arrested, jailed or convicted.

The least-bad option for many children may be remaining or being reunited with their parents, providing there is no abuse in the home. Child protective services workers often remove minors from neglectful parents who, while a far cry from being good caregivers, may still be better than group placements. That’s especially true of juvenile detention centers where children in the foster system who have broken no laws are made to feel like criminals, with predictably negative effects.

A juvenile court judge in New Orleans, Ernestine S. Gray, profiled recently by The Post’s Richard A. Webster, has made it her practice to reunite children with their parents except in extreme cases such as when a child has suffered abuse. Judge Gray’s rulings have resulted in comparably few children placed in foster homes in the city. Whether that has resulted in happier, better-adjusted kids is, unfortunately, less clear.