WASHINGTON — A federal judge ruled late Monday that former White House counsel Don McGahn must obey a subpoena for his testimony issued by the House Judiciary Committee.

Federal District Court Judge Ketanji Brown Jackson said McGahn must appear before Congress but retains the ability to "invoke executive privilege where appropriate" during his appearance.

"It is clear to this Court for the reasons explained above that, with respect to senior-level presidential aides, absolute immunity from compelled congressional process simply does not exist," Jackson said in her ruling.

"Presidents are not kings," she added.

"This means that they do not have subjects, bound by loyalty or blood, whose destiny they are entitled to control," Jackson said. "Rather, in this land of liberty, it is indisputable that current and former employees of the White House work for the people of the United States ... "

The Justice Department sought a stay of the ruling on Tuesday, as expected, while it pursues an appeal.

McGahn's lawyer, William Burck, said Monday that McGahn would comply with the judge’s decision unless it is stayed pending appeal.

White House press secretary Stephanie Grisham said officials there are "confident that the important constitutional principle advanced by the administration will be vindicated.”

Download the NBC News app for breaking news and politics

House Judiciary Chairman Jerrold Nadler, D-N.Y., hailed the judge's decision and said in a statement that he expects McGahn "to follow his legal obligations and promptly appear before the committee.”

House Intelligence Committee Chairman Adam Schiff, D-Calif., called the ruling a "victory for congressional oversight" and the American people.

“With today’s ruling, the courts have made it absolutely clear ... that absolute immunity is not a legitimate basis by which to prohibit senior White House officials from testifying before Congress. To those witnesses who hide behind fallacious claims of absolute immunity, this ruling shows again how meritless their position remains," he said in a statement Monday night.

Justice Department lawyers had argued that as a former close adviser to the president, McGahn could not be commanded to appear before Congress. The government said the long-standing view, under both Republican and Democratic administrations, is that the president and his immediate advisers are absolutely immune to such demands.

Administration lawyers cited a 1999 Justice Department legal opinion issued by Janet Reno, attorney general during the Clinton administration. "Subjecting a senior presidential advisor to the congressional subpoena power would be akin to requiring the president himself to appear before Congress" on matters related to his official duties, the Reno opinion said.

The current White House counsel, Pat Cipollone, notified the House that President Donald Trump directed McGahn not to testify before the House "in order to protect the prerogatives of the office of the presidency."

House Judiciary Democrats said they wanted McGahn to testify about actions by the president that former special counsel Robert Mueller's report said could constitute obstruction of justice. After McGahn declined to respond in March to a voluntary request for documents, the committee issued a subpoena April 22, describing him as "the most important witness, other than the president, to the key events that are the focus of the Judiciary Committee's investigation."

Last week, House lawyers urged the judge to issue a ruling quickly, explaining that the Judiciary Committee plans to hold its own impeachment hearings, separate from the recently concluded hearings held by the House Intelligence Committee.

While the Justice Department's view is that close advisers to the president cannot be forced to appear before Congress, no court has ever said so. In 2008, a federal judge in Washington rejected that view, ruling that Harriet Meiers, a White House counsel under President George W. Bush, could not refuse demands for her testimony.

The Bush administration appealed that ruling, but the case was dismissed after Meiers agreed to testify about the controversy generated by the firings of several U.S. attorneys. The 2008 ruling therefore is not binding on later cases.

The same question about White House immunity is pending before another judge in Washington in a lawsuit filed by former deputy national security adviser Charles Kupperman. The House withdrew its subpoena for his testimony, but the judge has so far declined to dismiss the case.