A federal judge in California on Friday ordered the Justice Department to stop threatening state and local election officials with prosecution if they refused federal demands tied to suspected non-citizen voting. The emergency ruling, issued by U.S. District Judge Trina Thompson, came in the final days before the November 3 midterm elections and marked a significant judicial rebuke of the administration’s late-stage intervention in election administration.

The order bars federal officials from using intimidation or coercion to force local administrators to remove voters, refuse ballots, or segregate ballots based on a federal list of alleged non-citizens. News accounts of the ruling said Thompson concluded the plaintiffs were likely to prevail on claims that the administration’s conduct interfered with lawful election administration and threatened protected voting activity.

The underlying lawsuit was brought by unions representing election workers along with allied groups challenging what they described as a coordinated federal pressure campaign. Separate reporting also showed the Justice Department had recently sought to isolate thousands of California ballots tied to voters the administration said might be non-citizens, an effort that had already drawn skepticism from other courts.

Conservative critics of federal judicial intervention are likely to argue that courts should be cautious about constraining legitimate enforcement of election law. But the narrower fact established by Friday’s order is that a federal court found the government could not, on the eve of an election, use prosecution threats to compel state and local officials to alter ballot-handling procedures outside ordinary legal process.