A federal judge ruled Sunday that President Trump’s appointment last year of Ken Cuccinelli to be head of U.S. Citizenship and Immigration Services was a violation of federal vacancy laws, and that Cuccinelli lacked the authority to issue policy directives tightening asylum rules.

U.S. District Judge Randolph D. Moss, an Obama appointee, said the administration violated the Federal Vacancies Reform Act of 1998 when it placed Cuccinelli, a conservative activist and former attorney general of Virginia, in charge of the agency that runs the nation’s legal immigration system.

The ruling amounts to a rebuke of Trump’s stated preference for filling top administration jobs with officials serving in an “acting” capacity. The president has said he prefers having top officials in an acting role because he thinks it makes them easier to remove than those with Senate confirmation.

USCIS officials did not immediately respond to requests for comment. The Trump administration is expected to appeal the decision.

Immigrant advocacy groups sued the administration last year on behalf of five Honduran asylum seekers — two adults and three children — who challenged the legality of the new restrictions on multiple grounds. Moss’s ruling addressed the first of their claims: that Cuccinelli lacked the authority to change U.S. asylum policies in the first place.

Moss agreed, writing that the vacancy rules require a federal agency’s “first assistant” to assume leadership when the top job is open.

“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.

The administration’s move to place Cuccinelli in charge was therefore unlawful, he wrote, and the policy memos he signed should be “set aside.”

Those include measures in July to reduce the amount of time afforded to asylum seekers to seek legal counsel after crossing the border and to restrict the ability of U.S. asylum officers to grant applicants extensions.

The implications of the judge’s ruling were unclear Sunday for other policy moves and administrative decisions made by Cuccinelli since Trump installed him in June. Cuccinelli remains in the top job at USCIS, and he is serving as the second-ranking official at the Department of Homeland Security, where he has been appointed to the White House’s coronavirus task force.

Senior staffers at DHS and USCIS have repeatedly expressed doubts about the legality of Cuccinelli’s authority, with several unclear about where he actually works.

According to his official biography page online, his title is senior official performing the duties of the deputy secretary for the Department of Homeland Security, and he is also the senior official performing the duties of the director, U.S. Citizenship and Immigration Services.