Eric Trump, Donald Trump Jr., Donald Trump and Ivanka Trump attend the Trump International Hotel Washington, D.C Groundbreaking Ceremony at Old Post Office on July 23, 2014 in Washington, DC.

Ramos, an appointee of President Barack Obama, said in U.S. District Court in Manhattan that the Trump clan's arguments "are not sufficiently serious as it relates to Supreme Court precedent" dealing with the question of turning over documents to Congress.

Judge Edgardo Ramos' ruling came after a hearing at which lawyers for Trump, his three older children, Donald Jr ., Eric and Ivanka , and the Trump Organization argued that the subpoenas to the two banks should be quashed. An appeal of the decision is all but certain.

A federal judge in New York City on Wednesday said Deutsche Bank and Capital One can turn over financial documents related to President Donald Trump and his businesses in response to subpoenas from two Democrat-led House committees.

The judge also disagreed with the argument by the Trump legal team that the demands for the documents from House Financial Services and Intelligence committees lacks a legitimate legislative purpose. Ramos said there is such a purpose in the request by the panels, which are probing alleged foreign influence in U.S. elections.

The subpoenas, Ramos said, are "undeniably broad but are clearly pertinent."

The White House and a spokesman for the Trump Organization did not immediately respond to a request for comment. Trump has said he is "fighting all the subpoenas" issued by House Democrats, who are conducting a broad inquiry into his financial affairs.

The ruling in the New York court came two days after another federal judge, in Washington, D.C., said Trump's accountants at the firm Mazars had to comply with a subpoena from the House Oversight and Government Reform Committee for his financial records.

Deutsche Bank for years has been the main lender for Trump, whom other banks have avoided loaning money to because of his repeated bankruptcies. Capital One is in possession of financial records related to the Trump Organization's hotels. Neither bank had opposed the subpoenas.

In a statement to CNBC after the ruling, Deutsche Bank spokeswoman Kerrie McHugh said, "We remain committed to providing appropriate information to all authorized investigations and will abide by a court order regarding such investigations."

The Trump family's lawyers, in a lawsuit filed against Deutsche Bank and Capital One in late April, challenged the demands for financial documents from the lenders, saying subpoenas from House Democrats "were issued to harass President Donald J. Trump, to rummage through every aspect of his personal finances, his businesses, and the private information of the President and his family."

Neither Deutsche Bank nor Capital One objected in court to the subpoenas. But House Democrats intervened in the lawsuit to argue against the Trump family's effort to quash the document demands.

Ramos' ruling came hours after the New York state Legislature passed two bills aimed at Trump, which would allow Trump's state tax returns to be turned over to Congress if they are requested. Gov. Andrew Cuomo has said he supports that idea, but has yet to say whether he will sign the bills.

The Treasury Department last week defied a subpoena from the U.S. House Ways and Means Committee for six years of federal tax returns of Trump and his business. But much of the information on those returns would be replicated in state tax returns.

During the court hearing Wednesday, Trump's lawyer, Patrick Strawbridge, argued that the subpoenas exceeded Congress' authority by being overbroad. He noted emphasizing that the committees were "literally looking for records about minors" related to Trump, as well as his in-laws.

At another point, Strawbridge argued that courts have made it "clear" that Congress "cannot cross the line into law enforcement activity."

Douglas Letter, an attorney for the committees seeking the documents, retorted that there is is "absolutely no merit to any of these arguments" made by Strawbridge.

"This is being totally misportrayed," Letter said.

Letter said that the subpoenas are broad, and asked for documents going back a number of years, because the committee are investigating things such as money laundering and engagement with foreign entities — "including Russian oligarchs" — over "a long period of time."

Ramos then asked why the committee was bothering to ask for "domestic documents" if that was the case.

"You have to look at: 'where's it going? ' " Letter responded, referring to money. "It's all tied together."

Letter criticized the Trump family's legal effort to thwart the subpoenas, saying that the lawsuit only had been filed "because of a massive and fundamental misunderstanding" of Congress' role "by Mr. Trump."

"He sees us as a nuisance," Letter said, referring to the president.

Asked by the judge if the financial records could be made public, Letter said that the committees did have that power.

But they "wouldn't do it willy-nilly," Letter insisted.

"We would of course listen" to the people whose records were subpoenaed, but ultimately "this is for the Congress" to decide, Letter said.

Lawyers for Deutsche Bank and Capitol One declined an opportunity to speak in court.

The judge said in his ruling that the attempt to block the subpoenas was "unlikely to succeed on the merits."

"The court concludes that a preliminary injunction" being proposed by Trump's lawyers "is inappropriate," Ramos said.

WATCH: The saga of Trump's taxes