(CNN) A federal judge on Sunday ruled that it was unlawful to appoint Ken Cuccinelli , an immigration hardliner chosen by President Donald Trump, to lead the agency responsible for processing US immigration requests.

Cuccinelli's appointment violated a statute that governs how most federal vacancies are filled, according to the ruling. As a result, the judge invalidated a set of US asylum policies for the asylum seekers who are part of the case.

Advocacy groups filed a federal lawsuit last year challenging the legitimacy of his role as acting director of US Citizenship and Immigration Services , asking the court to set aside asylum policy changes issued shortly after he took office. Cuccinelli is currently serving as the acting Deputy Secretary of the Department of Homeland Security, which oversees USCIS.

The lawsuit argued that Cuccinelli, who took over at the agency on June 10, 2019, did not satisfy the legal requirements to serve as the director under the Federal Vacancies Reform Act ("FVRA") and the Constitution.

The Trump administration has increasingly relied on filling top posts with people on a temporary basis. The Department of Homeland Security's major federal immigration agencies, are without permanent leaders.

Last month, acting Homeland Security Secretary Chad Wolf installed Joseph Edlow to run daily operations at USCIS as Cuccinelli remains the number two at Homeland Security headquarters.

Cuccinelli's appointment last year immediately raised legal questions over whether he could be placed to lead USCIS without a formal nomination. His official title was principal deputy director, but he was performing the duties of the acting director, an agency official told CNN at the time.

"Cuccinelli may have the title of Principal Deputy Director, and the Department of Homeland Security's order of succession may designate the office of the Principal Deputy Director as the 'first assistant' to the Director. But labels -- without any substance -- cannot satisfy the FVRA's default rule under any plausible reading of the statute," US District Court Judge Randolph D. Moss said in his ruling Sunday.

To support the point, Moss cited in a footnote the popular TV show "The Office," highlighting a "long-running riff" from the show "between one who serves as 'the assistant regional manager' and 'the assistant to the regional manager.'"

"But either way, that person is, at best, second in command. Here, the acting Secretary created a position that is second in command in name only," the footnote reads.

Appearing on Fox News Monday morning, Cuccinelli said the ruling was "something of an outlier," adding that the Trump administration plans to appeal the decision.

Moss found that as a result of Cuccinelli's unlawful appointment, Cuccinelli lacked authority to issue two of the directives challenged in the lawsuit.

Three weeks after assuming his new role, Cuccinelli issued a memorandum announcing a revised policy for scheduling credible-fear interviews, the first step in the asylum process, according to the court ruling. Under the revised policy, the agency reduced the time allotted for asylum seekers to consult with others prior to their interviews.

Under Cuccinelli, USCIS also prohibited granting asylum seekers extensions of time to prepare for their credible-fear interviews, "except in the most extraordinary of circumstances."

The asylum directives must be set aside, Moss ruled.

However, Moss wrote that he is "unconvinced" the court should extend this relief to other "asylum seekers who were processed under the defective directives."

And while he set aside the directives related to reducing consulting time and prohibitions on extensions, Moss also found that the court did not have jurisdiction on a challenge to limiting in-person orientation in a Texas immigration detention facility.

Sunday's ruling "calls into question any other directive Cuccinelli signed while purporting to serve as acting director, but given that most of the big policy shifts were approved higher up within DHS, the broader impact may be modest," said Steve Vladeck, professor at the University of Texas School of Law and CNN contributor.

Democracy Forward, one of the groups that filed the case, heralded Sunday's ruling. "Today's ruling is a big win that confirms Ken Cuccinelli's installation and service as acting director of USCIS was unlawful," Democracy Forward Executive Director Anne Harkavy said in a statement.

The case was filed by Democracy Forward, Catholic Legal Immigration Network, Inc. and Proskauer Rose LLP on behalf of seven asylum seekers and the Refugee and Immigrant Center for Education and Legal Services, a nonprofit that provides legal services to immigrants.

Moss, the judge who wrote the opinion, was a key Justice Department official in 2000 during the Bill Clinton administration. In an opinion for the Justice Department's Office of Legal Counsel, which Moss headed, he wrote an opinion that sitting presidents cannot be indicted.

CORRECTION: This story has been updated to reflect that Edlow was tapped to run daily operations at US Citizenship and Immigration Services in February. It has also been updated to include reaction from Cuccinelli.