A federal judge in California on Wednesday refused a Trump administration request to force the state to set aside the mail ballots of roughly 20,000 people the Justice Department says are likely noncitizens.

The department appealed within hours.

U.S. District Judge David O. Carter, a Clinton appointee, said the request would "wreak havoc and disrupt the election that is already underway," CNN reported. He issued his 26-page order a day after a lengthy hearing in Los Angeles. More than 3.7 million Californians had already voted, States Newsroom reported.

Carter wrote that the demand conflicted with longstanding constitutional principles that leave the running of elections to the states, CBS News reported. He also questioned how the list was put together. The department compiled it from a purchased roll of California voters matched against other government data, according to CNN.

The judge called the government's description of its methods vague and noted that similar claims in other states had proved unreliable, saying he could not find the process credible, NBC News reported. Los Angeles County told the court the data could not be trusted and that only about 7,000 of the 20,000 records had addresses in the county.

Carter added that the department already has another option: it can prosecute noncitizens accused of voting illegally.

The administration argues that waiting carries its own risk. Federal prosecutor Bill Essayli said election officials are processing more ballots every day and warned of the "dilution" of citizens' votes. He said the solicitor general had authorized an immediate appeal and that the department would ask the 9th U.S. Circuit Court of Appeals for an emergency order.

The appeals court has already been involved. On Monday, a three-judge panel voted 2-1 to dismiss an earlier emergency appeal as premature, because Carter had not yet ruled.

The department filed suit on Oct. 15 against California, Secretary of State Shirley Weber and Los Angeles County Registrar-Recorder Dean Logan. The case could reach the Supreme Court within days, States Newsroom reported. Election Day is Tuesday.