Commonwealth Bank of Australia will pay the biggest corporate fine in the country's history for failings that allowed drug gangs to launder money.

The record punishment for Australia's largest bank is the latest blow to the country's financial sector, which has been rocked by a series of scandals recently.

Austrac, a regulator that focuses on financial crime, said Monday that CBA (CBAUF) would pay $700 million Australian dollars ($534 million) to settle a lawsuit after the bank admitted it failed to observe laws to prevent money laundering and financing of terrorism.

Between 2012 and 2015, CBA failed to report more than 53,000 suspicious transactions using its ATMs to authorities on time. Drug gangs laundered money by taking advantage of a loophole that allowed for large, anonymous deposits to CBA accounts, Austrac said.

"As we have seen in this case, criminals will exploit poor business practices to launder the proceeds of their crimes," Austrac CEO Nicole Rose said in a statement.

Related: One of Australia's top financial firms is in crisis

"This has real impacts on the everyday lives of Australians and 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," she added.

Austrac first began legal action against the bank 10 months ago. CBA's payment of the fine is dependent on the settlement being accepted by Australia's federal court.

"While not deliberate, we fully appreciate the seriousness of the mistakes we made," CBA CEO 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."

CBA has blamed the failure to report suspicious transactions on time on a coding error in its computer systems.

Related: Australia's top bank says it charged dead clients for advice

It's the second blow in just over two months for the bank, whose shares are down about 13% so far this year.

In April, CBA admitted to charging fees to clients it knew had died years previously.

The bank told a Royal Commission inquiry that the practice of billing deceased customers for financial advice stretched back years. In one instance, an adviser at the bank's financial planning business was collecting fees from a client more than a decade after they had died.

A Royal Commission is Australia's highest form of public inquiry. It was ordered by Prime Minister Malcolm Turnbull at the end of last year in a bid to restore public confidence in the country's financial sector.

The commission is due to submit its findings to the government in February 2019.