California is one of 23 states the Justice Department has sued for refusing to hand over voters’ Social Security numbers and driver’s license information.

A federal judge Thursday dealt a significant legal setback to the Trump administration in its efforts to obtain voter data held by states.

In a 33-page order, U.S. District Judge David O. Carter in California dismissed a lawsuit that sought to give the Justice Department access to the Democratic-led state’s voter files, including records like Social Security numbers and driver’s license information.

The judge, a Clinton appointee, slammed those efforts in his ruling Thursday, writing that the administration’s request “threatens the right to vote which is the cornerstone of American democracy.”

“The Department of Justice seeks to use civil rights legislation which was enacted for an entirely different purpose to amass and retain an unprecedented amount of confidential voter data," Carter wrote. "The centralization of this information by the federal government would have a chilling effect on voter registration which would inevitably lead to decreasing voter turnout as voters fear that their information is being used for some inappropriate or unlawful purpose.”