With the issue of children being detained by immigration authorities in the news, it is worth remembering that around 2,000 babies are born in American prisons every year.

Many of them stay there and spend their first months living inside a correctional institution. This is a modern problem, born of our current climate of incarceration and contemporary views on parental rights and custody—and it’s one that nobody has been able to solve fairly, despite 150 years of trying.

To start with, the criminal justice system has always been designed around men. Women commit fewer crimes and there are very few women’s prisons (usually there’s only one women’s penitentiary per state, versus several correctional facilities for men). Prior to the mid-19th century, prisons typically held both men and women. The culture of incarceration was different than that of today—even as harsh punishments were meted out for what may seem now to be trivial crimes, people didn’t tend to be locked up for very long.

This might seem counterintuitive when we imagine harsh criminal justice systems. But that harshness meant either that the crime was capital, in which case the convict hanged, or it was pretty minor, in which case he or she got a short stretch in jail. (And hanging happened fast, typically within a month of conviction; the idea of lingering on death row also didn’t exist.) Long-term involuntary confinement was the province of another venue: the lunatic asylum.

Indeed, for non-insane prisoners, decades-long sentences were practically unheard of. In Britain and France, there was also the option of convict transportation for some of this period, and some of the women in prison were held pending passage to a penal colony. The other reason women could be held for longer was pregnancy: a pregnant woman sentenced to die would be allowed to wait until after the delivery to be executed (if giving birth in an 18th-century prison wasn’t fatal in itself). Those who have read Defoe’s Moll Flanders will recall that the heroine, born to an inmate at Newgate, had “pleaded her belly” to defer a date with the noose.

The environment in prisons also varied in its formality and level of control. Wealthy inmates could have their own food and belongings brought in (Newgate even had different sections for the poor and for those who could afford nicer digs). Meanwhile, inmates in debtors’ prisons (typically men) often had their whole families with them. Charles Dickens drew on his own experience with his father being sent to debtor’s prison when he wrote Little Dorrit, about a girl born and raised in Marshalsea. Some workhouses also took in families. The reforming and modernizing of the justice system from the mid-19th century onwards put an end to that kind of informality and brought us the prison industry of today. Our incarceration system doesn’t permit inmates to bring an entourage. People are sent to prison alone. That’s kind of the point.

But a woman who enters a prison alone may be carrying a child. What happens then?

By the 1860s, the Mount Pleasant women’s facility at Sing Sing prison had a nursery for female inmates and their babies born inside. Bedford Hills, a women’s correctional facility in New York, has had a nursery since it opened in 1901. Even then, babies weren’t expected to stay long—just long enough to be handed off for adoption. Nurseries where the babies stayed with their mothers became more popular in the mid-20th century, but have now fallen from favor.

Where they exist, babies get to stay on, through their toddlerhood, inside a jail. Is this better than being taken away? Most would agree that it is best for a baby to receive its mother’s care in the early months. On the other hand, a prison is hardly a good place for a child. Adult correctional facilities are not built with infants and toddlers in mind. Prisoner rights advocates have campaigned for incarcerated women to have access to their children for longer—prison-born infants can stay inside until the age of three in Washington State. Rarer still are programs like California’s, which allow some women to bring their small children to prison with them.

Scholars such as James G. Dwyer have questioned the value of such programs, asserting that they put the rights of mothers over the rights of children. Being in a prison, in the custody of a parent who may have a history of child mistreatment, is not necessarily in the infant’s best interests. It also keeps the children in a limbo situation—they can only stay in the prison as infants and young toddlers, at which point they are still likely to be handed off to relatives for temporary care during the rest of their mother’s sentences. Dwyer argues that, particularly for women serving longer terms, adoption might be the best outcome for such children. But the prison-nursery model doesn’t encourage that.

As Dwyer writes:

In any event, prison nursery programs will likely foreclose the possibility of adoption. Women facing a year or more of incarceration who are offered the opportunity to move to a nicer unit and live with the baby they just delivered are exceedingly unlikely to decline that opportunity.

So if having a baby is a ticket to a cushier environment, who wouldn’t choose that option? But Dwyer is correct that all such framing centers on the rights of the mother, not those of the child. Specifically it focuses on the rights of the women who happen to deliver their babies inside, not those who had to leave their babies behind when they were locked up.

The U.S. accounts for 30 percent of the world’s incarcerated women, with over 100,000 behind bars. The issue of how best to respect and care for their children is a problem that isn’t going away.

Katrina Gulliver is a historian who has written for The Spectator, TIME, The Atlantic, Slate, Reason, and The Weekly Standard. Currently she is working on a history of urban life. Follow her on Twitter @katrinagulliver.