Western Union Co. (NYSE:WU) has reached a settlement with U.S. regulators over charges that the bank failed to stop money laundering and wire fraud. The bank agreed to pay $586 million as part of the settlement. The penalty was imposed by the Justice Department and Federal Trade Commission. The fine is the biggest ever against a money-services company.

Western Union is currently the largest money-transfer business in the U.S. Wiring money can be the fastest way to send it, so many people use the service when they need to get money to another place quickly. In a statement, acting Assistant Attorney General David Bitkower said, “Western Union is now paying the price for placing profits ahead of its own customers.”

The charging document was filed in federal court in Harrisburg, Pennsylvania. The accusation says that lapses in the company’s anti-money laundering controls enabled illegal gambling and fraud schemes. Authorities say that tens of thousands of victims were affected. Prosecutors agreed to drop the case if the company made promised reforms within three years.

An investigation found that Western Union was used by undocumented immigrants from China to wire money to their human smugglers. Hundreds of millions of dollars were being sent to China in structured transactions designed to avoid reporting requirements under federal bank laws.

It was also claimed that Western Union agents were complicit in schemes that defrauded people in the U.S. The scheme occurred from as early as 2004 through 2012. Fraudsters contacted victims in the U.S. and directed the victims to send money through Western Union. Western Union agents processed the payments in return for a cut of the proceeds. The complaint claims that Western Union was complicit because the bank failed to suspend or terminate agents who knowingly entered fake information allowing the fraudsters to conceal their identities.

As part of the agreement, the company has admitted that it failed to maintain money-laundering controls. Western Union also admitted that it failed to take action as fraudsters around the world used its system. The company identified more than $500 million in consumer fraud transactions sent through its agents between 2004 and 2012. Western Union shares fell as much as 6 percent after the settlement was announced.

Western Union will announce its fourth-quarter results on Feb. 9. The company anticipates taking a charge of $570 million in its fourth-quarter earnings. The company is expected to post adjusted profits of $837 million in 2016.

In the final days of the Obama administration, there have been a wave of settlements resolve investigations into toxic debt, foreign bribery and auto-emissions cheating. The settlements have cost companies billions of dollars.

Get Analysts' Upgrades and Downgrades Daily - Enter your email address below to receive a concise daily summary of analysts' upgrades, downgrades and new coverage with MarketBeat.com's FREE daily email newsletter.