House Democrats investigating Donald Trump can have access to the former president’s personal financial records from 2017 and 2018, a federal judge ruled Wednesday, as well as information related to his lease of a building near the White House.

U.S. District Court Judge Amit P. Mehta of Washington had previously ruled that Trump’s accountants must turn over a broader array of records. But the U.S. Supreme Court subsequently ruled that courts must take separation of powers concerns into account when members of Congress want personal information from a president.

Democrats had argued that they needed access to Trump’s financial records from 2011 to 2018 to write legislation fixing “glaring weaknesses in current ethics legislation” exposed by Trump’s presidency. The president’s former attorney, Michael Cohen, testified that Trump routinely changed the value of his holdings in disclosures and provided documents to bolster his account.

Before testifying, Cohen had pleaded guilty in federal court to lying to Congress about Trump’s business interests and violating campaign finance laws in paying off women who claimed to have had affairs with Trump.

Mehta rejected the argument from House Democrats, saying Congress did not need the details of Trump’s finances beyond what has already been disclosed to write legislation demanding greater disclosure.

“The more Congress can invade the personal sphere of a former President, the greater the leverage Congress would have on a sitting President,” Mehta wrote.

But, the judge ruled, Congress could have records from 2017 and 2018 to further its role overseeing the president’s foreign business interests.

A president must seek Congress’s permission before accepting certain payments from foreign governments, Mehta noted. If lawmakers could not access the records, he wrote, “presidents could simply conceal foreign emoluments from Congress to avoid scrutiny — a result contrary to the Framers’ intent.”

While in office, Trump donated to the U.S. Treasury several hundred thousand dollars in foreign payments to his hotels, Mehta said, “thereby validating the Committee’s belief that President Trump’s businesses received some foreign payments during his presidency.”

“The Committee therefore is not engaged in a baseless fishing expedition,” he wrote.

Information related to Trump’s lease of the Old Post Office Building from the General Services Administration likewise does not violate the separation of powers, Mehta ruled, because lawmakers might well have demanded the same records from a private citizen. Trump chose to lease a building from the federal government, Mehta said, and to keep his stake in it while serving as president.

The situation, he wrote, “is unique to President Trump.”

House Oversight and Reform Committee Chairwoman Carolyn B. Maloney (D-N.Y.) said in a statement that she was “pleased” overall but disappointed “that the Court . . . narrowed the subpoena in some respects.”

She said the committee is “actively considering next steps.”

Elizabeth Wydra, president of the Constitutional Accountability Center, called the ruling “an important step in the journey of both holding Trump accountable and reacting to the vulnerabilities in our democracy laid bare by Trump’s presidency.”

But, she said, the fight has taken years and the documents have yet to be handed over.

“There are a lot of ways in which this is a case study in flaws in our democracy that need to be fixed, from pretty much top to bottom,” she said.

Sarah Turberville, director of the Constitution Project at the Project on Government Oversight, said it was “worrisome” to see Mehta apply a Supreme Court’s standard made for a sitting president to a former one.

“It is troubling to see this kind of creep of” the separation of powers rationale, she said, “because, over time, it will invariably aggrandize presidential power.”

Trump and his accountants, Mazars USA, could again appeal this decision.

His attorneys did not immediately return a request for comment. In court filings, they argued that Democrats had no valid legislative purpose.

The lawsuit is one of several court battles over the former president’s finances, some of which began not long after he took office and broke precedent by refusing to release his tax returns.

The House Ways and Means Committee is also seeking Trump’s tax returns, saying it needs them to write legislation closing loopholes in the code that benefit wealthy Americans.

After a different Supreme Court ruling in March, Trump’s accountants turned over related documents to Manhattan District Attorney Cyrus R. Vance Jr. (D), whose prosecutors have charged the Trump Organization with a 15-year “scheme to defraud” the government and its chief financial officer with grand larceny and tax fraud.