By Dave Michaels

WASHINGTON -- Lawyers for Bank of America Corp. wrote last year that prosecutors had warned the bank against doing its own analysis of potentially manipulative trading out of concern the findings could contradict the government's investigation.

A prosecutor told Bank of America that contradictory findings would be "unhelpful" to one probe and could endanger the sentencing credit the bank was hoping to get for cooperating, according to a letter included in a court filing by two former traders fighting criminal charges.

The April 2019 letter, which was addressed to the Justice Department's fraud section prosecutors, could hurt the government's efforts to prosecute the former Bank of America traders. In their filing in Chicago federal court, the traders, who are expected to stand trial next year on charges related to manipulating prices for precious metals, said the letter is potentially exculpatory and alleged the Justice Department withheld it for months until Bank of America was about to disclose it to them.

"These materials provide damning evidence of a contrived investigative process," attorneys for the traders at Kobre & Kim LLP wrote.

Spokesmen for the Justice Department and Bank of America declined to comment. The law firm that wrote the letter and represented Bank of America didn't respond to requests for comment.

Bank of America's letter states that DOJ agreed in 2017 to have the bank analyze some of the trading, applying the government's criteria for what qualified as questionable trading. The bank's experts used the DOJ's criteria for identifying the trading, known as "spoofing," but the formula turned out to be flawed, according to the letter.

The DOJ then revised the criteria and asked Bank of America to use the new parameters to examine the traders' conduct, the letter says. The traders, Edward Bases and John Pacilio, were charged in January 2018.

Spoofing generally involves the use of misleading orders that induce others to buy or sell at a price desired by the wrongdoer. But detecting which orders are phony is difficult in futures markets, which are dominated by high-speed traders that constantly cancel and update prices.

The Justice Department has said it has expertise in using computer programs to find spoofing. Prosecutors have hired economic consultants to help them detect spoofing in futures markets and prepare for trials, The Wall Street Journal reported in February.

In the filing on Tuesday, the traders argued the DOJ's revisions show it has "engaged in confirmation bias," in effect designing the analytical process to fit its belief that the traders were guilty.

The traders asked U.S. District Judge John Z. Lee to order a prosecutor, one not involved with the case, to search the DOJ's files for any evidence that could be exculpatory.

The information discussed in Bank of America's letter could become part of the traders' defense at trial.

Bank of America paid $25 million in fines last year to settle the DOJ investigation. The deal, a nonprosecution agreement with subsidiary Merrill Lynch Commodities Inc., required the bank to cooperate with the investigation of individual traders. Bank of America paid another $11.5 million to resolve civil claims brought by its regulator, the Commodity Futures Trading Commission.

The Justice Department has cracked down on spoofing since Congress outlawed it in 2010. The Bank of Nova Scotia said Wednesday that it would pay $127.5 million to resolve DOJ and CFTC allegations that four former traders spoofed precious metals markets from 2008 to 2016.

Prosecutors have a mixed record with charging individual traders. Many have pleaded guilty, but prosecutors have lost two of three spoofing trials they have conducted.

Write to Dave Michaels at dave.michaels@wsj.com