The Justice Department on Friday released its legal rationale for refusing to provide President Trump’s tax returns to Congress, arguing that House Democrats want to make the documents public, which “is not a legitimate legislative purpose.”

Treasury Secretary Steven Mnuchin refused to hand the documents over early last month, writing in a letter to House Ways and Means Committee Chairman Richard E. Neal (D-Mass.) that the committee’s demand was “unprecedented” and could “have lasting consequences for all taxpayers.” After getting legal advice from the Justice Department, Mnuchin said he had determined the request should be refused.

Rep. Don Beyer (D-Va.), who serves on the committee, disputed the notion that lawmakers were using a “pretextual” basis — or dubious justification — for demanding the materials.

“Here’s what is actually ‘pretextual’ — the President telling a Cabinet Secretary to ignore the law to protect him, the Secretary usurping legal responsibilities of the IRS Commissioner to do it, and the OLC coming up with these flimsy, bogus excuses that won’t stand up in court,” he wrote on Twitter.

Legal analysts have said Mnuchin’s decision was a highly unusual move, given the language of the law covering the matter, and some House Democrats have said they expect to take legal action to get a court to intervene. A confidential Internal Revenue Service legal memo obtained by The Washington Post says tax returns must be given to Congress — unless the president were to assert executive privilege, which he has not done in this instance.

The fight over the president’s tax records is one of several ongoing battles between congressional Democrats and the White House over access to documents and witnesses, matters that seem destined to end up in court.

The administration has fought particularly hard against congressional demands for Trump’s financial records. Trump sued in an attempt to block the House Oversight Committee from getting records from his accounting firm, though a federal judge last month ruled against the president. The case is being appealed.

Trump had said during the campaign that he would be willing to release his “very big . . . very beautiful” tax returns, but as his candidacy picked up, he asserted that an ongoing IRS audit prevented their disclosure. Later, he claimed voters were not interested in the documents and would learn nothing from seeing them.

The memo on Trump’s taxes is written in part with an eye toward the expected court fights, and at one point its author, Assistant Attorney General Steven A. Engel, suggested judges should be reticent to intervene in such disputes.

“Separated from the democratic process, the federal courts are not well equipped to second-guess the action of the political branches by close scrutiny of their motivations,” Engel wrote in the 33-page memo. “These same limitations do not apply to the Executive Branch, which operates as a politically accountable check on the Legislative Branch.”

The Ways and Means Committee is seeking tax returns and other Trump business information from 2013 through 2018, relying on a law that says the Treasury Department “shall furnish” tax-return information upon “written request” from that panel’s chairman. The committee issued subpoenas for the records last month.

Individuals’ tax returns are among the most closely guarded secrets inside the U.S. government, partly as a result of a 1976 law designed to curb abuses by the Nixon administration, in which tax returns were used for political purposes.

The Justice Department’s opinion argues that the committee’s request is simply partisan politics that carried over from Trump’s refusal during the 2016 presidential campaign to publicly release his tax returns. For decades, major presidential candidates have made their tax returns public.

The memo cited statements made by leading Democrats during the campaign and after Trump became president to argue that the Democrats are trying to violate important boundaries between the executive and legislative branches for short-term political gain.

“The Chairman’s request that Treasury turn over the President’s tax returns, for the apparent purpose of making them public, amounted to an unprecedented use of the Committee’s authority and raised a serious risk of abuse,” Engel wrote in the memo, which is dated Thursday. “Congress could not constitutionally confer upon itself the right to compel a disclosure by the Executive Branch of confidential information that does not serve a legitimate legislative purpose.”

Engel said that while the executive branch “should accord due deference and respect to congressional requests,” it does not need to treat them “as unquestionable.”

The president, Engel wrote, “stands at the head of a co-equal branch of government, and he is separately accountable to the people for the faithful performance of his responsibilities. Treasury thus had the responsibility to confirm for itself that the Chairman’s request serves a legitimate legislative end.”