The U.S. Commodities Futures Trading Commission announced Wednesday the result of joint enforcement action with the New York Attorney General's Office in which two brokerage firms have agreed to pay a total of $25 million to state and federal regulators to avoid potential criminal charges and civil litigation over allegations that their employees used illegal methods to solicit consumer trading of foreign currencies.

The New York Attorney General's Office said BGC Financial LP and GFI Securities LLC, had violated the state's Martin Act, which is used to police fraudulent activity on Wall Street.

"What happens on Wall Street impacts families on Main Street," said New York Attorney General Letitia James. "That's why maintaining the integrity of our financial markets is of paramount importance to my office."

James said the penalties imposed were intended to deter future brokerage firms from engaging in the same misconduct.

A three-year investigation by the New York Attorney General's Office and CFTC found that brokers at the firm had engaged in a series of deceptive practices, like posting fake trades, bids and offers of foreign exchange currency options, or FX options.

An FX option is an agreed upon exchange rate of two different currencies used by traders to turn a profit, based on the value of those currencies. That kind of trading averages trillions of dollars per year, according to the Attorney General's Office.

Trades are regularly made via direct communication with brokerage firms, though bids can be posted electronically as well.

The investigation from state and federal regulators found that, during a two-year period from 2014 to 2015, the firms had posted fake bids and offers on their digital platforms when no financial institution had offered a trade at that level.

That was done, according to the New York Attorney General's Office, to entice trading by creating a false appearance of a more favorable market.

The firms were also accused of announcing trades that never happened for the same purpose. The practice, called "printing," is when a firm announces a fake trade to encourage more activity. The firms did so when they were communicating with traders directly, according to the investigation.

Those practices, according to the New York Attorney General's Office, violated the state's Martin Act. The statute, which is nearly a century old, is used by the state to levy criminal charges and civil litigation over allegations of securities fraud.

At the federal level, the misconduct was contrary to the Commodity Exchange Act and federal regulations, according to the CTFC.

BGC, which acquired GFI in 2016, agreed to pay $7.5 million each to New York state and the CFTC to avoid civil litigation and any potential criminal charges that could accompany the misconduct. GFI agreed to pay $5 million each to the state and the CFTC.

"Brokers and other intermediaries play a critical role in our markets," said James McDonald, director of enforcement at the CFTC. "The CFTC is committed to protecting the integrity of our markets by ensuring they are held accountable for fraudulent misconduct."

Aside from the financial penalties, the brokerage firms agreed to implement policies and procedures, including training, to avoid a future situation where employees enter into the same kind of misconduct.

The firms also agreed to retain an independent monitor, who will oversee operations and compliance by the companies and report to the New York Attorney General's Office. The employees involved in the misconduct also won't be allowed to work on their respective foreign exchange desks for a period of five years.

If the New York Attorney General's Office finds that the firms continued to engage in misconduct following the agreement announced Wednesday, they'll still have the opportunity to pursue litigation.

The agreements specifically note that the statutes of limitations will be tolled until the independent monitor is done overseeing the firms. The monitor is scheduled to perform that duty for a year, but that time period could be extended, according to the agreements.

Both firms were represented in the agreements by David Meister a partner at Skadden, Arps, Slate, Meagher & Flom LLP in Manhattan. The general counsel for each firm, according to the agreements, is Stephen Merkel.

A spokeswoman for the firms did not immediately respond to a request for comment on the agreements.

READ MORE: