New York (AFP) - Global payments company Western Union will pay $586 million to settle a US criminal investigation that found it had a weak anti-money laundering program and looked the other way when employees collaborated in fraud.

The settlement, which includes a deferred prosecution agreement, concerns violations uncovered between 2004 and 2012 in which the company failed to adequately safeguard its money transfer system from transactions that could have supported illicit activity such as human trafficking, drug dealing and other crimes.

The settlement covers investigations by the US Justice Department and Federal Trade Commission.

The agencies found instances where fraudsters posed as family members and sought funds for promised prizes or job opportunities.

Various Western Union agents participated in the scam in exchange for a portion of the proceeds, the Justice Department said in a press release. And when Western Union became aware of the wrongdoing, it failed to terminate or take action against the employees.

Western Union employees also worked to help customers get around requirements to file a currency transaction report when more than $10,000 is wired to a client in a single day.

Western Union sent hundreds of millions of dollars to China in transactions designed to avoid the US Bank Secrecy Act that included large sums for human smuggling, investigators said.

"As this case shows, wiring money can be the fastest way to send it -- directly into the pockets of criminals and scam artists," said acting assistant Attorney General David Bitkower. "Western Union is now paying the price for placing profits ahead of its own customers."

The agency will "work to recoup losses and compensate victims."

Western Union said it has boosted spending on compliance by 200 percent and now spends about $200 million with about 20 percent of its staff dedicated to the oversight. It said its performance in detecting fraud has improved markedly since the period in question and that the dollar value connected to fraud relative to overall activity has fallen by 60 percent.

"We share the government's goal of protecting consumers and the integrity of our global money transfer network, and we worked hard to resolve these matters with the government," the company said in a statement.

Shares of Western Union fell 2.9 percent in midday trading to $21.22.