Federal courts have been busy scrutinizing the government’s handling of immigration. In February, two important rulings went against the Obama administration, which, in the absence of congressional action, is increasingly attempting to make policy on its own.

The first decision, staying an administrative directive that would have allowed about five million undocumented immigrants a reprieve from deportation, received intensive coverage. But while the media buzzed after a court questioned a lenient initiative, little attention was paid when, a few days later, another court shot down one of the Department of Homeland Security’s harsher policies.

The second case, RILR v. Johnson, was brought by mothers and their minor children who fled violence in Central America and sought asylum in the United States. The plaintiffs argued that they were being unlawfully detained by Immigration and Customs Enforcement (ICE) while their asylum claims were processed.

The legal question was whether the courts could hear detainees’ contention that they were being denied constitutional due process rights. The administration argued that its discretion in enforcing immigration laws allowed it to operate without judicial oversight. But Judge James Boasberg of the District of Columbia District Court was unmoved by that defense and sided with the detainees.

Detainees seeking asylum have a right to raise a due process claim under the Fifth Amendment.

In the past, ICE generally did not hold families apprehended in the United States who had a credible fear of persecution in their home country. After first determining their potential flight risk and danger to the community, the majority of families would be released on bond or their own recognizance. But conditions changed abruptly in June 2014 when the Department of Homeland Security adopted what Judge Boasberg called an “unprecedented” no-release policy in response to a Central American “immigration spike.” In practice, a few families were still released, but most were held in detention centers. The purpose, Judge Boasberg wrote, was to “send a message that such immigrants, coming en masse, are unwelcome.”

As in the earlier case concerning the executive-granted deportation reprieve, the judge here decided that the administration lacks the broad and unchecked prosecutorial discretion, either according to the Constitution or statute, to adopt the policy at issue—this time, a detention regime aimed at deterring immigration. Instead, plaintiffs have a right to raise a due process claim under the Fifth Amendment.

Judge Boasberg was blunt in his dismissal of the administration’s position, which included an assertion that the no-release policy was sacrosanct because of the executive’s responsibility to ensure national security. While the judge conceded that the administration is entitled to deference in “cases implicating national security, a uniquely executive purview,” he did not equate deference with acquiescence. “Incantation of the magic words ‘national security’ without further substantiation is simply not enough to justify significant deprivations of liberty,” he wrote. The administration, he decided, had not offered a defensible national-security interest to connect the aim of the challenged policy to its actual effect. When a policy demands significant deprivation of liberty, “it cannot be justified by mere lip service,” he concluded.

Judge Boasberg’s unwillingness to yield to a general claim of national security is reminiscent of Justice Robert Jackson’s in the 1950 case of Ellen Knauff. Knauff, who was German, married a U.S. soldier and came to New York City in 1948 to meet his parents. She was detained on arrival at Ellis Island and held for three years as a security risk. The Truman administration refused to release to her or her attorney any information alleging disloyalty. In Knauff v. Shaughnessy, the Supreme Court decided in favor of the administration, prompting Justice Jackson, in dissent, to lament, “Security is like liberty in that many are the crimes committed in its name.”

This time around, the administration also argued that the plaintiffs could not seek relief because they are “noncitizens, whose entry into this country was unlawful.” From ICE’s standpoint the plaintiffs “have extremely limited, if any, due process rights regarding [their] custody determinations.” “The Government is mistaken,” Judge Boasberg replied. He agreed that constitutional protections are not available to aliens outside U.S. borders, but once an alien enters the country the legal circumstances change. The Constitution’s due process clause applies to everyone within the United States, including aliens, even when their presence is unlawful or temporary. As the Supreme Court decided in Shaughnessy v. United States ex rel. Mezei (1953), even aliens who enter the country illegally “may be expelled only after proceedings conforming to traditional standards of fairness encompassed in due process of law.” He also rejected the government’s assertion that statute “contains no limitation on the Executive’s discretion to detain.”

Given the clear-cut application of due process rights even to noncitizens, the courts, Judge Boasberg concluded, have to oversee the incarceration of immigrants. In spite of the “broad latitude” due the executive branch in the realm of immigration, a federal court cannot “abdicate” its legal responsibility to review the lawfulness of detention.

Judge Boasberg also challenged the government’s factual claim that its detention policy deters immigration to the United States. The administration cited ICE Assistant Director for Field Operations Phillip T. Miller, who stated in immigration court, “Annual surveys of people in Central American countries show that one key factor that influences the decision whether to migrate is the existence of an ‘active migration network,’ i.e. friends or family who previously migrated and are living in the United States.” Releasing immigrants pleading for asylum would invigorate those networks, he claimed. But Miller, and in turn the administration, had gotten the conclusions of those surveys wrong. Political scientist Jonathan Hiskey, who coauthored the study on which Miller relied, explained that ICE’s interpretation of his report “is erroneous and misplaced, demonstrating a failure to grasp the empirical findings and theoretical underpinnings.” Hiskey charged that the government had ignored the report’s central finding: that crime victimization is a critical impetus behind Central American immigrants’ dangerous decision to leave home and head for the United States.

Although the policies under the microscope in the two February cases were different, the legal questions were closely related. In both instances, the courts found that prosecutorial discretion doesn’t allow the executive branch to do whatever it wants with immigration policy. On the deportation reprieve, the judge cited a technicality in his ruling but also reasoned that Homeland Security policy amounted to an unconstitutional end-run around Congress. Similarly, Judge Boasberg denied prosecutorial discretion when it impugned a constitutional guarantee, this time the guarantee of due process. Together, the cases show a federal judiciary united against executive efforts to dispense with the problem of congressional gridlock by going it alone.