President Donald Trump's top immigration official entered his job unlawfully and now some of his policies must be "set aside," a federal judge ruled.

Cuccinelli was appointed as the acting director of the US Citizenship and Immigration Services last June, but federal vacancy rules required the "first assistant" step into the acting director role instead.

Immigration advocates sued the Trump administration last year over Cuccinelli's asylum policies, arguing that they couldn't be valid because Cuccinelli's appointment itself was not valid.

Visit Business Insider's homepage for more stories.

President Donald Trump broke the law to hire his top immigration official, a federal judge ruled Sunday.

Ken Cuccinelli took charge of the US Citizenship and Immigration Services agency last June as acting director and immediately began implementing policy memos to make US asylum policies more restrictive.

But those new rules must now be "set aside," US District Judge Randolph Moss wrote in a 55-page ruling.

Immigration advocates sued the Trump administration last year over Cuccinelli's asylum policies, arguing that they couldn't be valid because Cuccinelli's appointment itself was not valid.

Trump has filled a number of positions, including the secretary of the Department of Homeland Security, with officials in acting capacities. Though the roles are meant to be temporary until Trump can nominate a permanent leader, many have stretched on for months at a time.

Ken Cuccinelli AP Photo/Steve Helber

Trump has told media he prefers "acting" officials rather than formally confirmed ones because "it gives me more flexibility." But the lawsuit alleged that Cuccinelli's appointment violated the Federal Vacancies Reform Act and the Constitution.

On Sunday, Moss agreed, ruling that Trump bypassed USCIS' chain of command by appointing Cuccinelli.

According to federal vacancy rules, the top job should have been filled by the previous director's "first assistant." But Cuccinelli had only served as the "principal deputy director" of USCIS — a role that was created for him by the former acting DHS secretary.

"Cuccinelli's appointment fails to comply with the [law] for a more fundamental and clear-cut reason: he never did and never will serve in a subordinate role — that is, as an 'assistant' — to any other USCIS official," Moss wrote in his opinion.

Moss didn't specify a timeframe for the Trump administration, and Cuccinelli told "Fox & Friends" it will appeal the decision, calling it "really something of an outlier."

"It doesn't affect anything we're doing going forward," Cuccinelli said.