Image caption JP Morgan has paid close to $20bn to regulators in the past 12 months

JP Morgan Chase has agreed to pay $1.7bn (£1bn) to victims of the Bernard Madoff fraud following a settlement with US prosecutors.

The settlement comes after Federal prosecutors accused the bank of ignoring red flags about Madoff's crimes.

"We recognize we could have done a better job," said JP Morgan spokesperson Jennifer Zuccarelli.

The bank has agreed to improve its controls as part of the settlement.

"It took until after the arrest of Madoff, one of the worst crooks this office has ever seen, for JP Morgan to alert authorities to what the world already knew," said George Venizelos, head of the FBI's New York office, during a press conference.

No jail

This shows mainly that JP Morgan is determined to settle and the quicker the better John Coffee, Columbia University Law School

The settlement includes a so-called deferred prosecution agreement that will dismiss criminal charges after two years if the bank remains compliant.

No individual executives were accused of wrongdoing.

Seth Berenzweig, a corporate lawyer, says US authorities are reluctant to press criminal charges against major banks.

"It's very dangerous to criminally indict a commercial bank," Mr Berenzweig told the BBC.

"It could throw the institution into a tailspin - and the government can't afford a banking crisis with JP Morgan."

But, he adds, the agreement was "not necessarily in the best interest of the victims".

JP Morgan was Madoff's primary bank in the later years of a fraud that lasted for decades.

The bank had a relationship with Madoff dating back to 1986, according to documents released by the US Attorney's office.

It ended in 2008 when Madoff revealed to the FBI that his investment advisory business was a Ponzi scheme.

According to the complaint, Madoff's account - account 703 - received deposits and transfers totalling $150bn over the period from 1986 until the fraud was discovered in 2008, almost exclusively from Madoff Securities.

Highlights from the settlement A private client affiliated with a bank that JP Morgan later absorbed asked his bank to replicate how Madoff generated a reported 830% return on his investments, from $183m to $1.7bn over 12 years. They could not.

Chase Alternative Asset Management - a JP Morgan "fund of funds" open to investors - considered including Madoff's fund. A fund manager commented in 1998 that the returns were "possibly too good to be true".

In August 2007, a trader on the Equity Exotics desk tried to replicate the returns reported by a Madoff fund tied to S&P 500 performance during the period. He wrote the stock market performance was "far away" from the returns Madoff "allegedly made".

In March 2009 - three months after Madoff's arrest - a banker at JP Morgan formerly in charge of Madoff's account received a form letter from JP Morgan's compliance department. It asked him to certify that the client relationship complied with "all legal and regulatory-based policies".

JP Morgan employees began raising red flags about the account from the late 1990s up until 2008, but no action was taken to alert US regulators.

The 75-year-old Madoff pleaded guilty to the fraud and is currently serving a 150-year prison sentence in the US.

Mounting fines

Over the past year, JP Morgan has paid close to $20bn in settlements with regulators for various violations relating to the US financial crisis, the so-called "London whale" trading loss, and manipulating the London inter-bank offered rate, or Libor.

In his annual letter to shareholders from April 2013, Mr Dimon wrote: "I feel terrible that we let our regulators down".

Columbia University law professor John Coffee says this settlement is simply indicative of the bank's efforts to clear its name.

"Again, this shows mainly that JP Morgan is determined to settle and the quicker the better," Prof Coffee told the BBC.

"The one remaining large obstacle is China and the Foreign Corrupt Practices Act", a reference to charges that JP Morgan selectively hired the sons and daughters of China's elite as a way to gain entry into the market.

Shares in JP Morgan fell slightly on Tuesday.