Lawyers for the president are fighting document and witness subpoenas on multiple fronts, and Mehta’s ruling came hours after former White House counsel Donald McGahn was directed not to appear before a congressional committee seeking testimony about his conversations with Trump.

President Trump is locked in a battle over congressional subpoenas, including from the House Oversight Committee, chaired by Rep. Elijah E. Cummings (D-Md.), right. (Jabin Botsford; Salwan Georges/The Washington Post)

Congressional Democrats have vowed to fight for evidence of potential misconduct by Trump and those close to him, and the president’s legal team is broadly resisting those efforts. How those fights play out in court in the months ahead could impact the 2020 presidential race.

In his decision, Mehta flatly rejected arguments from the president’s lawyers that the House Oversight Committee’s demands for the records from Trump’s accounting firm, Mazars USA, were overly broad and served no legitimate legislative function.

“It is simply not fathomable,” the judge wrote, “that a Constitution that grants Congress the power to remove a President for reasons including criminal behavior would deny Congress the power to investigate him for unlawful conduct — past or present — even without formally opening an impeachment inquiry.”

Trump has argued those congressional inquiries are politically motivated attacks on the authority of the presidency, while Democrats insist the subpoenas are essential to ensuring no president is above the law.

When the lawsuit was filed, Trump’s private attorney Jay Sekulow said the president’s team “will not allow Congressional Presidential harassment to go unanswered.”

The company said in a statement that it will “respect the legal process and fully comply with its legal obligations.”

While Democrats scored the first court victory in the fight over the president’s financial records, it is unclear how many of these disputes will reach higher courts, or how those courts might rule.

Rep. Elijah E. Cummings (D-Md.), chairman of the House Oversight Committee, said the ruling “lets America know that we have ground to stand on and that we have a legitimate argument and the courts support them. . . . I’m glad it was a strong decision; that bodes well, hopefully, in the future for an appeals process.”

Mehta’s ruling drew comparisons between Trump and President James Buchanan, whom historians have blamed for failing to prevent the Civil War and who is generally considered one of the country’s worst leaders. Buchanan, too, complained bitterly about “harassing” congressional inquiries.

Mehta noted that Congress also launched an investigation into the conduct of Bill Clinton before he entered the White House.

“Congress plainly views itself as having sweeping authority to investigate illegal conduct of a President, before and after taking office,” he wrote. “This court is not prepared to roll back the tide of history.”

The judge gave the White House a week to formally appeal the decision, adding that “the President is subject to the same legal standard as any other litigant that does not prevail.”

An appeal could test decades of legal precedent that has upheld Congress’s right to investigate — a legal battle that is just one part of a broader effort by House Democrats to examine Trump’s finances, his campaign and allegations that he sought to obstruct justice in special counsel Robert S. Mueller III’s Russia investigation.

In the Mazars case, Mehta cut down Trump’s lawyers’ complaint that Congress was usurping the Justice Department’s powers to investigate “dubious and partisan” allegations of private conduct by inquiring into whether Trump misled his lenders by inflating his net worth.

Rather, Mehta said, a congressional investigation into illegal conduct before and during a president’s time in office fits “comfortably” with Congress’s broad investigative powers, which include an “informing function,” or the power to expose corruption.

Trump, his three eldest children and his company also are attempting to block a subpoena, issued by the House Financial Services Committee, seeking Trump’s bank records from Deutsche Bank AG and Capital One. A federal judge in Manhattan is set to hear that case Wednesday.

The pace of the president’s legal fights with Congress is intensifying.

House Intelligence Committee Chairman Rep. Adam B. Schiff (D-Calif.) said Monday that his panel will vote Wednesday to enforce its subpoena seeking the release of still-redacted portions of Mueller’s report, along with certain underlying materials.

Schiff accused the Justice Department of granting Republican lawmakers’ document requests and denying demands from Democrats.

“The refusal by the department, if it persists, will be a graphic illustration of bad faith and a unwillingness to cooperate with lawful process,” Schiff said.

On Monday, the Justice Department issued a formal legal opinion saying that McGahn, the former top White House lawyer, could not be required to appear before lawmakers in response to a congressional subpoena.

Democrats subpoenaed McGahn to testify Tuesday morning, hoping he would become a star witness in their investigation into whether Trump obstructed justice. As detailed in Mueller’s report, McGahn provided critical testimony about several instances of potential obstruction by Trump.

“The Department of Justice has provided a legal opinion stating that, based on long-standing, bipartisan, and constitutional precedent, the former counsel to the president cannot be forced to give such testimony, and Mr. McGahn has been directed to act accordingly,” White House press secretary Sarah Sanders said in a statement. “This action has been taken in order to ensure that future presidents can effectively execute the responsibilities of the office of the presidency.”

The 15-page legal opinion written by Assistant Attorney General Steven A. Engel argues McGahn cannot be compelled to testify before the committee, based on past Justice Department legal memos regarding the president’s close advisers.

The memo says McGahn’s immunity from congressional testimony is separate and broader than a claim of executive privilege.

The immunity “extends beyond answers to particular questions, precluding Congress from compelling even the appearance of a senior presidential adviser — as a function of the independence and autonomy of the president himself,” Engel wrote.

Trump told reporters the action was taken “for the office of the presidency, for future presidents. I think it’s a very important precedent. And the attorneys say that they’re not doing that for me; they’re doing it for the office of the president.”

Those comments underscore the high stakes of Trump’s current standoff with Congress — if either side loses a legal ruling by an appeals court or the Supreme Court, the reverberations could be felt far beyond the Trump administration, changing the balance of power between the executive and the legislative branches of government for years to come.

In the fight over McGahn’s testimony, the Justice Department insists that immunity from testimony does not evaporate once a presidential adviser leaves the government because the topics of interest to Congress are discussions that occurred when the person worked for the president.

As a private citizen, McGahn is not necessarily bound by the White House directive, or the Justice Department memo, to refuse to comply with the subpoena. McGahn’s lawyer notified the committee that he would not appear.

The move to bar McGahn from answering lawmakers’ questions angered House Democrats eager to hit back at what they view as White House stonewalling. The defiance raises the possibility that the House will hold McGahn in contempt of Congress, as House Judiciary Committee Chairman Jerrold Nadler (D-N.Y.) has threatened — a threat he reiterated Monday night.

“It is absurd for President Trump to claim privilege as to this witness’s testimony when that testimony was already described publicly in the Mueller report,” Nadler said in a statement. “Even more ridiculous is the extension of the privilege to cover events before and after Mr. McGahn’s service in the White House.”

An increasing number of Democrats also want to begin impeachment proceedings against Trump even though House Speaker Nancy Pelosi (D-Calif.) last week privately played down the possibility and encouraged her members to focus on their policy agenda.

Some Democrats argue that opening an impeachment inquiry will strengthen their hand in trying to force the White House to comply with document requests and witness testimony, including McGahn’s.

House Democrats were hoping to make McGahn their key witness as they seek to unpack the findings of the Mueller report — particularly regarding questions of whether Trump obstructed justice.