WASHINGTON (Reuters) - A U.S. Justice Department attorney on Thursday spelled out the circumstances under which Special Counsel Robert Mueller could be fired in a court case that took on new significance this week after President Donald Trump ousted his attorney general.

FILE PHOTO: Special Counsel Robert Mueller departs after briefing the U.S. House Intelligence Committee on his investigation of potential collusion between Russia and the Trump campaign on Capitol Hill in Washington, U.S., June 20, 2017. REUTERS/Aaron P. Bernstein -/File Photo

The case, argued on Mueller’s behalf by Deputy Solicitor General Michael Dreeben who is working temporarily on assignment in Mueller’s office, started months ago as a challenge to the legality of Mueller’s appointment and his authority.

When Trump ousted Attorney General Jeff Sessions on Wednesday and replaced him with Matthew Whitaker, Democrats in the U.S. Congress immediately warned that Trump might be moving to dismiss Mueller and squash his probe.

The 18-month-old Mueller probe into Russian meddling in the 2016 U.S. presidential election and possible collusion between Moscow and the Trump campaign has clouded the Trump presidency.

Russia denies it meddled in the election. Trump, who frequently blasts the Mueller probe as a “witch hunt,” denies any campaign collusion with the Russians.

In May, Andrew Miller, who is an associate of long-time Trump adviser Roger Stone, refused to comply with a grand jury subpoena from Mueller. Miller was held in civil contempt. He filed a legal challenge, asserting Mueller has no authority to compel his testimony or to oversee the probe because he was illegally appointed.

Dreeben told a three-judge appeals panel on Thursday that there are checks and balances on Mueller’s activities that make his appointment lawful. One of these is that he could be fired by Whitaker, now acting attorney general, if Whitaker revoked department regulations governing Mueller’s appointment to make him fireable without cause.

The special counsel is not “off in a free-floating environment,” Dreeben said in arguments before the U.S. Court of Appeals for the District of Columbia Circuit that attempted to show Mueller’s power is circumscribed by the law.

Central to the case is whether Mueller is an inferior or a principal officer under the Appointments Clause of the U.S. Constitution. Dreeben argued Mueller is an inferior officer and subject to the direction and supervision of presidentially appointed officials.

Miller’s attorney Paul Kamenar argued Mueller is a principal officer and cannot be fired except for good cause.

Mueller was named special counsel by Deputy Attorney General Rod Rosenstein after Sessions recused himself from the probe. Rosenstein lost his role as Mueller’s supervisor to Whitaker on Wednesday when Sessions was forced out by Trump.

Whitaker has been critical of Mueller’s probe in the past and Democrats in Congress have called on him to recuse himself.

A Justice Department spokeswoman has declined to comment on whether he may recuse himself. Whitaker has not yet discussed how he may handle the Mueller investigation.

The three-judge panel did not indicate when it may rule in the case.