WITH the dawn of Donald Trump’s second year in the White House less than a fortnight away, debate over immigration, a central focus of his campaign, has reached a pivotal moment. On January 9th, with a partisan immigration battle raging on the other coast, a federal judge in California released a bold 49-page order. Judge William Alsup told the Trump administration to restart Deferred Action for Childhood Arrivals (DACA), the programme Barack Obama crafted through executive action in 2012 for people who arrived illegally in America when they were children. The White House's reaction to Judge Alsup’s injunction was swift and familiar: Sarah Sanders, Mr Trump's press secretary, declared the ruling “outrageous”; on Twitter Mr Trump castigated America’s judiciary as “broken and unfair”.

The legal fight over Mr Trump’s handling of DACA dates to September 2017, when Jeff Sessions, the attorney-general, announced the programme was “inconsistent with the constitution’s separation of powers” and would be rescinded. Anyone with deferred action would continue to be shielded until at least March 5th 2018, when renewal applications would no longer be accepted. DACA did not provide legal status or a path to citizenship for so-called “dreamers”. But the 800,000 young immigrants it permitted to live in America and work on the books without fear of deportation suddenly found themselves facing a precarious situation.

Under Judge Alsup’s order, the Trump administration is required to “maintain the DACA programme on a nationwide basis” while a lawsuit challenging its cancellation proceeds. “All agree that a new administration is entitled to replace old policies with new policies”, Judge Alsup acknowledged, “so long as they comply with the law”. But Mr Trump’s reason for undoing DACA did not meet this standard, the ruling says. It was based on a “mistake of law”, a “flawed legal premise”. When the Department of Homeland Security rolled back DACA, its action was “arbitrary and capricious”, Judge Alsup wrote. The Trump administration may have thought the Obama administration had exceeded statutory and constitutional bounds when it issued DACA, but the move was actually well within Mr Obama’s authority. Mr Trump thus halted the programme needlessly and without justification.

Legal scholars on opposite sides of the ideological spectrum are unimpressed by this argument. Josh Blackman, a conservative law professor at the South Texas College of Law, says the ruling is “ludicrous” and constitutes “an amateur act of punditry”. Mr Blackman cannot recall “any decision where a court has ordered a president to exercise discretionary authority he has deemed unconstitutional”. Noah Feldman of Harvard Law School agrees. While “admirable” as an effort to protect dreamers, Mr Feldman writes, the federal judge’s ruling “can’t be correct”. “If President Barack Obama had the legal authority to use his discretion to create DACA in the first place”, Mr Feldman reasons, “Mr Trump must have the legal authority to reverse DACA on the ground that he considers it to have exceeded Mr Obama’s powers.” It is “cute” for Judge Alsup to cite a tweet from Mr Trump frowning on “throw[ing] out good, educated and accomplished young people who have jobs, some serving in the military” to show that the president “publicly favours the very programme the agency has ended”—but this is neither here nor there, Mr Feldman writes. The bottom line is that presidents have broad authority to make or rescind policies with the stroke of a pen.

This critique of Judge Alsup’s ruling will probably persuade a majority of justices at the Supreme Court, should the matter get that far. But the refutation is strong enough that even the famously liberal Ninth Circuit Court of Appeals—the tribunal that has been the target of several angry presidential tweets—may reverse the district court judge’s ruling. In the end, it seems odd to insist that it is not within a president’s discretion to end a policy that his predecessor implemented using his own discretion.

This week, the administration announced that 200,000 Salvadorans who were granted temporary protected status after earthquakes wracked their country in 2001 would have to leave America. On January 10th, immigration agents raided nearly 100 7-Eleven stores in 17 states, hunting for undocumented workers and punishing bosses for employing them. And on the same day, Republican leaders in the House of Representatives offered a plan that, while saving DACA, would crack down on some illegal and legal immigrants alike. As litigation proceeds in the DACA lawsuit, it seems the judiciary may indeed be, as Alexander Hamilton wrote in the Federalist Papers, "the least dangerous branch". The rest of the federal government is marching forward with plans to weaken America’s embrace of those who seek its shores.