Bank of America Corp's Merrill Lynch unit will pay $415 million and admit to wrongdoing to settle charges that it misused customer cash to generate profits and failed to safeguard their securities from creditors, the U.S. Securities and Exchange Commission said on Thursday.

An SEC investigation found that Merrill Lynch violated an SEC rule in place for protecting customers' assets by misusing customer cash that should have been deposited in a reserve account, the agency said.

The maneuver freed up billions of dollars per week from 2009 to 2012 that Merrill Lynch used to finance its own trading activities, the SEC said.

The case is the largest customer protection settlement in SEC history, Andrew Ceresney, direction of the SEC's Division of Enforcement, said in a call with reporters.

But if Merrill Lynch's business failed during those trades, customers would have been exposed to a massive shortfall in the reserve account, the SEC said.

"While no customers were harmed and no losses were incurred, our responsibility is to protect customer assets and we have dedicated significant resources to reviewing and enhancing our processes," said Merrill Lynch spokesman William Halldin, in a statement.

"The issues related to our procedures and controls have been corrected. We have cooperated fully with the SEC staff throughout this investigation," Halldin said.