A federal judge rejected President Trump's effort to block congressional subpoenas seeking his financial records from two banks on Wednesday, the second time in a week a judge has ruled in favor of Congress in its efforts to obtain the president's records.

Mr. Trump, his children and the Trump Organization had sued to block Deutsche Bank and Capital One from complying with the subpoenas issued by the House Financial Services Committee and House Intelligence Committee.

At a hearing in federal court in Manhattan on Wednesday, U.S. District Judge Edgardo Ramos sided with congressional Democrats and declined to prevent the banks from complying with the subpoenas, saying they were "likely lawful."

Get Breaking News Delivered to Your Inbox

During an hour of oral arguments, Patrick Strawbridge, the lead attorney for the president's team, said the subpoenas went beyond Congress' authority and were seeking "exposure expressly for the sake of exposure." Ramos found that argument "unpersuasive," and said the subpoenas were issued for a "legitimate legislative purpose," citing an anti-money laundering bill introduced in the House earlier this year.

Douglas Neal Letter, the lead attorney for the House, said concerns that the records would immediately leak if turned over to the committees were unfounded. He said lawmakers could eventually vote to make them public, but that congressional committees "don't just willy-nilly disclose things."

In a brief moment of levity, Ramos asked Letter, "How far can I go with giving leeway to Congress?" Letter cited Supreme Court precedent to argue the subpoenas fell clearly within Congress' investigative authority, to which Ramos replied, "Well, then, what am I even doing here?"

After a brief recess, Ramos read his lengthy decision from the bench. He said Congress' investigatory powers were broad, and that it is "not the role of the judicial branch to question [Congress'] motives."

Ramos denied every request made by the president's legal team, including a request to issue a stay on his ruling. The lawyers told Ramos it was a "safe bet" they would appeal the decision.

Attorneys for Deutsche Bank and Capital One were at Wednesday's hearing but did not address the court. Both banks were named as co-defendants in the suit.

The decision comes two days after a federal judge in Washington, D.C., ruled in favor of the House Oversight Committee, which is seeking records from Mr. Trump's longtime accounting firm. The judge in that case also declined to block the committee's subpoenas, saying they and Mr. Trump's lawyers quickly filed a notice of appeal.

The back-to-back victories in court are likely to strengthen House Speaker Nancy Pelosi's argument that Democrats can investigate the president without opening an impeachment inquiry. Some Democratic lawmakers have argued an impeachment inquiry is necessary to obtain the records numerous committees are seeking.

At a meeting of House Democrats on Wednesday, Rep. Maxine Waters, the chairman of the House Financial Services Committee, emphasized the committee's efforts to obtain the Deutsche Bank records. "We must keep doing our work," Waters said, according to Democratic source familiar with the meeting.

Mr. Trump has been a client of Deutsche Bank for decades, and owes the bank at least $130 million through his various business entities, according to his 2019 financial disclosure form.

Deutsche Bank has also been subpoenaed by New York Attorney General Letitia James, who is investigating the president's business dealings. The subpoenas in that investigation, to Deutsche Bank and Investors Bank, seek records related to financing for four projects by the Trump Organization, as well as Mr. Trump's unsuccessful attempt to buy the Buffalo Bills several years ago.

Rebecca Kaplan contributed reporting.