Former White House counsel Don McGahn must comply with a subpoena to testify before Congress, a federal judge ruled Monday, saying "Presidents are not kings."

The Department of Justice said it will appeal the ruling.

The case stemmed from an August lawsuit filed against McGahn by the House Judiciary Committee. The committee issued a subpoena to McGahn in April, seeking his testimony on matters related to former special counsel Robert Mueller's Russia probe.

Trump administration lawyers responded that McGahn is "immune" from being compelled to testify. But U.S. District Judge Ketanji Brown Jackson of Washington disagreed.

"It is clear to this Court," Jackson said, "that, with respect to senior-level presidential aides, absolute immunity from compelled congressional process simply does not exist."

"Stated simply, the primary takeaway from the past 250 years of recorded American history is that presidents are not kings," added the judge, an Obama appointee.

McGahn's attorney, William Burck, said his client "will comply with Judge Jackson's decision unless it is stayed pending appeal."

Minutes later, Justice Department spokeswoman Kerri Kupec confirmed to CNBC that the agency will appeal the ruling and seek to halt it from taking effect in the meantime.

White House press secretary Stephanie Grisham argued in a statement that Jackson's ruling "contradicts longstanding legal precedent established by administrations of both political parties."

"We will appeal and are confident that the important constitutional principle advanced by the administration will be vindicated," Grisham said.

Though the case predates the focus of the House impeachment inquiry into President Donald Trump, the ruling was expected to have implications on that investigation, as a test of Congress's powers to compel witness testimony from those who have worked in the executive branch.

One such potential witness, former national security advisor John Bolton, has said he will not testify unless a court orders him to do so. One of his deputies, Charles Kupperman, filed a lawsuit in October asking a different federal judge whether he must comply with a congressional subpoena to testify to impeachment investigators.

Kupperman and Bolton share a lawyer, and the outcome of Kupperman's suit could determine whether Bolton testifies.

In her ruling, Jackson said the law also required "other current and former senior-level White House officials" who are subpoenaed to appear.

House Democrats have sought to dismiss Kupperman's lawsuit, fearing delays could stymie the momentum of their investigation. In November, the leaders of the impeachment investigation withdrew the Kupperman subpoena and urged him instead to be "guided" by the outcome of the McGahn case.

Though he has not testified, Bolton has emerged repeatedly in the recollections of other witnesses as a potentially instrumental witness for Democrats. The former National Security Council official Fiona Hill testified last week that Bolton was concerned by the actions of U.S. Ambassador Gordon Sondland, White House acting chief of staff Mick Mulvaney and others.

Hill testified last week that Bolton told her to go to the lawyers for the National Security Council to tell them that he was "not part of whatever 'drug deal' Sondland and Mulvaney were cooking up," Hill said.

Bolton has signaled that he holds little sympathy for the White House. On Friday, he accused the administration of locking him out of his Twitter account, questioning whether the move was due to "fear of what I may say." Trump denied that he had Bolton's account locked.

McGahn, the most prominent figure in Mueller's report, was supposed to testify before the committee about events examined by the former FBI director's investigation in May.

A day before his testimony was scheduled to take place, White House Counsel Pat Cipollone wrote to Judiciary Committee Chairman Jerry Nadler, D-N.Y., saying that McGahn was "absolutely immune from compelled congressional testimony."

The Judiciary Committee argued that such blanket immunity was not lawful and ran afoul of the Constitution's separation of powers. In court papers, the committee also argued that McGahn's testimony would be crucial to the committee's "decision whether to recommend articles of impeachment."

Nadler said in a statement Monday night that he expects McGahn "to follow his legal obligations and promptly appear before the Committee."