Because Cuccinelli's USCIS position was designated initially as "first assistant" to the USCIS director, the Trump administration reasoned that Cuccinelli could become acting chief under a provision of the 1998 Federal Vacancies Reform Act.

But Moss wrote that Cuccinelli's appointment did not comply with the FVRA because "he never did and never will serve in a subordinate role — that is, as an 'assistant' — to any other USCIS official." Rather, Cuccinelli was "assigned the role of principal on day-one," Moss wrote.

The order strikes down directives from Cuccinelli that sped up asylum-seekers' initial screenings limited extensions of those hearings, on the grounds that Cuccinelli lacked authority to issue them.

When Cuccinelli was promoted to No. 2 at DHS he told the staff he would be succeeded as acting USCIS chief by his deputy, Mark Koumans. Eventually, however, the Trump administration decided Cuccinelli should perform both jobs simultaneously. Today, Cuccinelli's USCIS job title is "senior official performing the duties of the director," according to the agency's website.

Weekly Shift The latest news in employment, labor and immigration politics and policy. Sign Up Loading By signing up you agree to receive email newsletters or alerts from POLITICO. You can unsubscribe at any time. This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The lawsuit was brought by the pro-immigration advocacy groups Democracy Forward and the Catholic Legal Immigration Network on behalf of an immigration legal center and seven asylum-seekers.

“This is both a victory for the rule of law and a significant blow to the Trump administration's xenophobic agenda,” Democracy Forward Executive Director Anne Harkavy said in a written statement.

Trump never nominated Cuccinelli to fill either of the two positions that he holds at USCIS and DHS, and he likely won't because of Cuccinelli's unpopularity with leading Senate Republicans due to his previous stewardship of the Senate Conservatives Fund, which ran primary campaigns against Republican incumbents, including Majority Leader Mitch McConnell.

DHS did not immediately respond to a request for comment.