Australia’s biggest bank has been hit with a record fine after a money laundering scandal – failing to report over 50,000 suspicious transactions to the country’s financial regulator Austrac over a period of several years.

The Commonwealth Bank agreed on Monday to pay $700 million (US$534 million) to settle a lawsuit after admitting it failed to observe laws designed to prevent money laundering and the financing of terrorism.

Drug gangs took advantage of the bank’s lax reporting, which allowed large anonymous deposits to be put into the bank’s accounts, Austrac said.

“Criminals will exploit poor business practices to launder the proceeds of their crimes,” Austrac CEO Nicole Rose said in a statement.

The bank’s failure to adhere to the law “puts the community at risk by increasing opportunities for terrorists to support attacks here and overseas, and enabling organized crime groups to peddle drugs to our families and friends,” Rose said.

The fine was fourth biggest ever imposed by regulators around the world and way over the $45 million imposed in March last year on gaming company Tabcorp, which broke the same laws.

The bank blamed its failure to adhere to the law on a coding error in its computer systems.

“While not deliberate, we fully appreciate the seriousness of the mistakes we made,” Commonwealth Bank chief Matt Comyn said in a statement. “Our agreement today is a clear acknowledgment of our failures and is an important step towards moving the bank forward. I apologize to the community for letting them down.”

Australia has had a flurry of banking scandals in recent months, after Prime Minister Malcolm Turnbull succumbed to public pressure late last year and agreed to call a Royal Commission into banking practices.

The Commonwealth Bank also admitted in April that it had charged dead clients for financial advice – in one case for years after a customer had died.