Deutsche Bank has agreed to pay $150 million to settle allegations that it maintained weak internal controls, including processing hundreds of transactions for Jeffrey Epstein despite the billionaire’s troubled history.

The penalty announced Tuesday by New York State Department of Financial Services marks the first time regulators have punished a bank for its relationship with Epstein, a convicted sex offender.

Despite knowing Epstein’s “terrible criminal history,” the bank “inexcusably failed to detect or prevent millions of dollars of suspicious transactions,” Linda A. Lacewell, the superintendent of financial services, said in a statement.

The settlement comes almost exactly a year after Epstein was arrested on accusations he had abused women and girls for decades, and enlisted his victims to recruit others. Prosecutors said Epstein preyed on the financial needs of his victims by promising them career opportunities and educational assistance, and used a convoluted web of shell companies to conceal the trafficking and abuse. He allegedly used private planes, helicopters, boats and cars to transport them to his secluded islands.

Epstein, 66, hanged himself last summer in his cell at the Metropolitan Correctional Center in Manhattan.

Epstein’s longtime confidant Ghislaine Maxwell — daughter of the late media tycoon Robert Maxwell — was arrested July 2 in New Hampshire on charges she recruited and groomed underage girls for abuse by her then-boyfriend. Starting in at least 1994, a grand jury indictment alleges, she “enticed and groomed multiple minor girls to engage in sex acts with Jeffrey Epstein, through a variety of means and methods.”

Deutsche Bank expressed regret for its relationship with Epstein in a statement. “Our reputation is our most valuable asset and we deeply regret our association with Epstein,” said company spokesman Daniel Hunter.

The German bank’s ties to Epstein began in 2013, years after the billionaire pleaded guilty to two prostitution charges in Florida, according to the consent decree filed by the New York regulator. Deutsche Bank knew about Epstein’s past, classifying him as a “high-risk” client, but also considered the relationship potentially lucrative — $100 million to $300 million in revenue over time.

In 2014, the bank’s anti-financial crime unit grew concerned about Epstein after new reports emerged about his alleged victims. Deutsche Bank executives met with Epstein at his New York home and asked about the veracity of the allegations.

The bank ultimately decided to continue doing business with Epstein but established new safeguards, which were largely ignored, according to the consent decree.

“The Bank’s fundamental failure was that …[it] failed to scrutinize the activity in the accounts for the kinds of activity that were obviously implicated by Mr. Epstein’s past,” the consent decree says.

Deutsche Bank processed more than $7 million in settlement payments to Epstein’s alleged co-conspirators, as well as more than $800,000 in suspicious cash withdrawals, the regulator said. But it didn’t inquire or block the transactions with “named co-conspirators” or ask what Epstein was spending $200,000 per year in cash on.

Instead of monitoring his accounts for “all potential crimes and suspicious activities,” one of the bank’s anti-financial crime officials, for example, simply searched the Internet to verify that transactions didn’t involve girls younger than 18.

Deutsche Bank should have known Epstein’s transactions were suspicious but suffered from “a series of procedural failures, mistakes, and sloppiness” in how it oversaw his accounts, according to a statement from the New York regulator. The bank didn’t end its relationship with Epstein until 2018, a month after the Miami Herald published damaging details about an Epstein plea deal.

“For years, Mr. Epstein’s criminal, abusive behavior was widely known, yet big institutions continued to excuse that history and lend their credibility or services for financial gain,” New York Gov. Andrew M. Cuomo (D) said in a statement.

Deutsche Bank said it cooperated with the investigations, spent $1 billion to improve its internal compliance systems and tripled the size of its anti-financial crime team to 1,500 people. The state regulator credited the bank for its “exemplary cooperation” with investigators.

“We all have to help ensure that this kind of thing does not happen again,” Christian Sewing, the bank’s chief executive, said in a note to the company’s employees. “It is our duty and our social responsibility to ensure that our banking services are used only for legitimate purposes.”

The $150 million penalty also covered Deutsche Bank’s conduct in two money laundering cases. The New York State Department of Financial Services said Deutsche failed to properly monitor the activities of two foreign bank clients, Danske Estonia and the Federal Bank of the Middle East, or FBME. The bank ignored red flags in its relationships with the financial institutions, including Danske Estonia, which is at the center of one of the world’s largest money laundering schemes.

Deutsche Bank is also at the center of another high-profile legal fight.

The U.S. Supreme Court is considering whether the House Financial Services and Intelligence committees can subpoena documents related to President Trump’s finances — many of which are held by Deutsche Bank, the only major lender to do business with him in recent years. The bank remains his biggest creditor, having loaned him more than $2 billion, the New York Times reported.