Money services giant Western Union has agreed to forfeit a record $586 million to settle charges that it facilitated fraud by failing to properly enforce its anti-money laundering systems, resulting in the processing of “hundreds of millions of dollars” in illegal transactions.

U.S. authorities said Western Union turned a blind eye as fraudsters used its service to move cash, with its own employees sometimes processing payments in return for a cut of the proceeds.

The settlement announced Thursday concludes investigations by the Department of Justice and the Federal Trade Commission. As part of a deferred prosecution agreement, Western Union admitted to a willful failure to maintain an effective anti-money laundering program and aiding and abetting wire fraud.

The $586-million forfeiture, which will go toward reimbursing consumers who were victims of fraud from 2004 to 2012 , is the largest-ever imposed on a money services business.

“Western Union owes a responsibility to American consumers to guard against fraud, but instead the company looked the other way, and its system facilitated scammers and rip-offs,” FTC Chairwoman Edith Ramirez said in a news release.

The DoJ said it had, among other things, uncovered a scheme whereby Western Union employees helped illegal immigrants from China send money back to the people who smuggled them across the border by wiring the payments in small increments so they wouldn’t trigger the reporting requirements of the Bank Secrecy Act.

In the case of one agent involved in such transactions, Western Union knew about the illegal conduct for at least five years but “its employees fought to keep this agent working for Western Union — as well as several other high-volume independent agents in New York City — because of the high volume of their activity,” Eileen Decker, U.S. Attorney for Los Angeles, said.

Wifredo A. Ferrer, the U.S. Attorney in Miami, said the misconduct reflected “a flawed corporate culture that failed to provide a checks and balances approach to combat criminal practices,.”

“Western Union’s failure to implement proper controls and discipline agents that violated compliances policies enabled the proliferation of illegal gambling, money laundering and fraud-related schemes,” he added.