Separating families, as a Trump administration policy now requires when migrants enter the United States unlawfully, is certainly cruel. Lost in the morally superior ruckus dominating immigration debates over the last weeks is the Obama administration’s embrace of an equally troubling alternative. For much of his presidency, Obama oversaw a family detention network in which children were locked up alongside their mothers. Obama’s family detention set the stage for Trump’s family separation.

In early May, Trump’s attorney general, Jeff Sessions, announced that federal officials would take children from their parents if they were caught entering the United States without the government’s permission. “If you don’t want your child separated, then don’t bring them across the border illegally,” he said. Justice department lawyers, he added, will file criminal charges against parents who enter the United States without the federal government’s permission. Separating children from parents facing criminal prosecution, Trump’s chief of staff, John F Kelly, added, would deter people who are thinking of coming. An April memo to the secretary of homeland security, Kirstjen Nielsen, said this would be the “most effective” way of keeping people from coming to the border.

Democrats have pounced on the Trump administration’s new policy and hammered the cruelty of its rationale. They are right to do so. The causes of migration are complicated and the trek northward possible only for the courageous, but these complexities are lost in the Trump administration’s demonization of migrants. In the continuing quest to police immigration law, the administration romanticizes the power of the criminal justice system and offers nothing more than lip service to the people caught up in the push of poverty or violence in Latin America and the pull of a better future in the United States.

Where Democrats are wrong is to imply that the Trump administration’s policy of separating families opens a new chapter in the annals of migrant scapegoating. President Obama and his top officials did so too by wholeheartedly embracing a policy that is essentially the other side of the coin from family separation. Six months into his presidency, Obama shut down a 500-bed facility in Texas that housed entire families. But when young migrants and families began arriving in the United States in increasing numbers in the summer of 2014, the Obama administration quickly reversed itself. Family detention became a cornerstone of Obama’s second term. Mothers were detained with children, sometimes no more than a few months old, while fathers were separated from their loved ones. In out-of-the-way Artesia, New Mexico, the Department of Homeland Security built a temporary facility to detain migrant families. Soon it contracted with a private prison corporation to build a permanent 2,400-bed site an hour south of San Antonio. The Obama administration never looked back.

There are remarkable similarities between what happened then and what is happening now. Just like John Kelly rationalizes family separation, Obama officials claimed family detention was necessary to deter migrants. His homeland security chief, Jeh Johnson, told the Senate in 2014 that detaining mothers and children was part of the administration’s “aggressive deterrence strategy” regarding unauthorized border crossings. A senior DHS official told lawyers representing the government in immigration court that opposing migrants’ release on bond “would help … by deterring further mass migration”. And in the press release announcing the opening of the family prison south of San Antonio that critics call “baby jail”, Ice claimed confining families behind fences would “deter[] others from taking the dangerous journey and illegally crossing into the United States”. Eventually federal courts pointed out that Ice can’t detain people as a means of deterring others.

Under Obama, Ice simply shifted its formal rationale, but it didn’t alter what it was doing. Family detention, it began to claim, was needed to protect the public or ensure that people showed up for court dates. This put the DHS’s conduct on more solid legal ground, but it didn’t lessen one bit the moral stain of family detention.

Under Trump, the government’s policy has shifted, but the cruelty of its conduct toward migrants hasn’t budged. Detaining families together hurt children, upended families and pushed immigration law to its limits, but that did not stop Democrats from defending it. Instead of raising a morally superior nose to the Trump administration’s new policy of separating children from their parents, people concerned about protecting families should take this opportunity to seriously consider ending the immigration laws that justify these alternative forms of government cruelty.

For the immigration law system to function, the United States doesn’t have to shift between detaining families and separating them. It could instead breathe life into our legal tradition’s respect for liberty and close the doors of immigration prisons.