Federal investigators believe North Korea used a China-based front company to evade sanctions and earn "hundreds of millions of dollars" to fund its nuclear program, according to a newly unsealed appellate court ruling.

The ruling says investigators allege the North Koreans exported coal and other valuable minerals via their front company, generating revenue in U.S. currency, with three Chinese banks handling the transactions.

A secret federal investigation into the transactions was made public after federal prosecutors subpoenaed the Chinese banks for the records of the company's transactions, and the banks fought the subpoenas in a case that went to the Washington, D.C., federal appeals court. The names of the banks and of the alleged front company are redacted.

The July 30 ruling upholding the subpoenas was first reported by Bloomberg News. Bloomberg said that the banks "appear to be" China Merchants Bank Co., Bank of Communications Co. and Shanghai Pudong Development Bank Co., all among the country's largest.

In its ruling, the court's three-judge panel noted that the U.S. "government does not currently suspect the banks of any wrongdoing," but that investigators think the banks' records "may clarify how North Korea finances its nuclear weapons program." The records sought are from 2012 to 2017 and include documentation of deposits, withdrawals and transfers by the alleged front company, which is now defunct.

The judges noted that the U.S. government traveled to China twice to try and negotiate the release of the bank records with the Chinese government without success.

An FBI special agent also told the panel, in a declaration submitted by prosecutors, that in a separate case involving North Korea, the Chinese government had agreed to work jointly with U.S. authorities on requests for bank records. However, nothing came of the U.S. requests.

"One reason that Chinese authorities do not want to assist with North Korean investigations," the agent wrote, "is that producing such records could reflect badly on the Chinese government and the Chinese financial industry."

The three judges concluded their opinion and order by affirming the contempt order by the D.C. District Court, which will impose fines against the three banks at $50,000 per day if they don't comply with the subpoenas.

On Monday, diplomatic sources told NBC News that the UN Security Council had assessed in a report that North Korea had generated up to $2 billion for its weapons program via cyberattacks on banks and cryptocurrency exchanges.

According to the diplomats, the report said these attacks permit the North "to generate income in ways that are harder to trace and subject to less government oversight and regulation than the traditional banking sector."