The bank will pay $1.7 billion to settle criminal charges and a $350 million civil penalty for what the Treasury Department called "critical and widespread deficiencies" in its programs to prevent money laundering and other suspicious activity.
George Venizelos, head of the FBI's New York office, said the company failed to carry out its legal obligations while Madoff "built his massive house of cards."
"It took until after the arrest of Madoff, one of the worst crooks this office has ever seen, for J.P. Morgan to alert authorities to what the world already knew," he said in a statement.
The $1.7 billion represents the largest forfeiture by a U.S. bank and the largest Department of Justice penalty for a Bank Secrecy Act violation, the government said.
The settlement includes a so-called deferred prosecution agreement that requires the bank to acknowledge failures in its protections against money laundering but also allows it to avoid criminal charges. No individual executives were accused of wrongdoing.
The agreement, which was announced by the office of U.S. Attorney Preet Bharara, resolves two felony violations of the Bank Secrecy Act in connection with the bank's relationship with Bernard L. Madoff Investment Securities, the private investment arm of Madoff's former business.
The civil penalty was imposed by the Treasury Department's Office of the Comptroller of the Currency.
The government said the civil penalty was assessed because the bank failed to pass along to U.S. authorities what it had told Britain's Serious Organised Crime Agency and also because the bank had failed to detect and report to authorities other cases of suspicious activity, including more than $2 billion in transactions involving the Puerto Rican affiliate of an unidentified Venezuelan bank.
Under the agreement, criminal charges will be deferred for two years as JPMorgan admits to its conduct, pays the $1.7 billion to victims of Madoff's fraud and reforms its anti-money laundering policies, prosecutors said in a release.
A statement of facts included in the agreement describes internal communications at JPMorgan expressing concerns about how Madoff was generating his purported returns. It says executives were disturbed by the fact that Madoff wouldn't let the bank examine his books.
"How much do we have in Madoff at the moment?" a bank analyst wrote in a 2008 email. "To be honest, the more I think about it, the more concerned I am."
In a statement, JPMorgan said it recognized it "could have done a better job pulling together various pieces of information and concerns about Madoff from different parts of the bank over time."
It noted that in late October 2008 it filed the U.K. suspicious activity report but didn't file one in the United States. The fraud was revealed with Madoff's arrest in December 2008.
"We do not believe that any JPMorgan Chase employee knowingly assisted Madoff's Ponzi scheme," the bank said. "Madoff's scheme was an unprecedented and widespread fraud that deceived thousands, including us, and caused many people to suffer substantial losses."
It said it was making "significant efforts" to strengthen its anti-money-laundering practices and believed "the lessons we have learned will make us a stronger company."
Its shares fell 55 cents to $58.45 in morning trading Tuesday.
The deal was similar to one reached in late 2012 with the British bank HSBC, which agreed to pay $1.9 billion to settle claims it laundered money for Iran, Libya and Mexico's murderous drug cartels. Some observers called the HSBC settlement - which included a $1.25 billion forfeiture and $655 million in civil penalties - an example of the government stopping short of bringing criminal charges against a big bank or its executives because such prosecutions could be devastating enough to cause the institution to fail.
JPMorgan was Madoff's primary bank in the later years of a multi-decade fraud that ended in 2008 when he revealed to the FBI that his investment advisory business was a Ponzi scheme.
Account statements for thousands of clients showing $60 billion in assets were fiction. Of the roughly $17.5 billion in principal that was real, most of it was gone.
Since then, a court-appointed trustee has recovered more than $9.5 billion to redistribute to burned clients.
The trustee sued JPMorgan for $6.4 billion in 2010, accusing the bank of being "willfully blind" and "thoroughly complicit" in the fraud, but an appeals court found in 2012 that he had no legal standing to make the claim.
The JPMorgan settlement is the latest in a series of major deals it has made to resolve its legal troubles. In November, the bank agreed to pay $13 billion over risky mortgage securities it sold before the financial crisis - the largest settlement to date between the Justice Department and a corporation.
JPMorgan still has several lawsuits pending against it related to the high-risk mortgage bonds that soured after the housing market collapsed in 2007. There's also an ongoing criminal investigation led by the office of U.S. Attorney Benjamin Wagner in Sacramento, Calif.
The bank may be negotiating or litigating over the issue for years and has set aside $23 billion to cover those costs. JPMorgan told regulators in a filing in October that it may need as much as $5.7 billion more.
Madoff, 75, pleaded guilty and is serving a 150-year prison term.
AP Business Writer Marcy Gordon in Washington contributed to this report.
Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.