NEW YORK — JPMorgan Chase & Co., already beset by costly legal woes, will pay more than $2.5 billion for ignoring obvious warning signs of Bernard Madoff’s massive Ponzi scheme, authorities said Tuesday.

The nation’s largest bank will forfeit a record $1.7 billion to settle criminal charges, plus pay an additional $543 million to settle civil claims by victims. It also will pay 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.

The bank failed to carry out its legal obligations while Madoff “built his massive house of cards,” George Venizelos, head of the FBI’s New York office, said at a news conference.

“It took until after the arrest of Madoff, one of the worst crooks this office has ever seen, for JPMorgan to alert authorities to what the world already knew,” he said.

Madoff banked at JPMorgan through what court papers referred to as the “703 account.” In 2008, the bank’s London desk circulated a memo describing JPMorgan’s inability to validate his trading activity or custody of assets and his “odd choice” of a one-man accounting firm, the government said.

In late October 2008, it filed a suspicious activity report with British officials. In the weeks that followed, JPMorgan withdrew about $300 million of its own money from Madoff feeder funds. The fraud was revealed when Madoff was arrested in December 2008.

“Despite all these alarm bells, JPMorgan never closed or even seriously questioned Madoff’s Ponzi-enabling 703 account,” said U.S. Attorney Preet Bharara. “On the other hand, when it came to its own money, JPMorgan knew how to connect the dots and take action to protect itself against risk.”

Prosecutors called the $1.7 billion the largest forfeiture by a U.S. bank and the largest Department of Justice penalty for a Bank Secrecy Act violation.

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 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 Treasury Department’s civil penalty was assessed because the bank failed to pass along to U.S. authorities suspicions about Madoff it had reported to Britain’s Serious Organised Crime Agency, and because the bank failed to detect and report other cases of suspicious activity, including more than $2 billion in transactions involving the Puerto Rican affiliate of an unidentified Venezuelan bank, authorities said.

Under the agreement, criminal charges will be deferred for two years as JPMorgan admits to its conduct, pays the $1.7 billion a fund established for victims of Madoff’s fraud and reforms its anti-money laundering policies, prosecutors said.

A statement of facts included in the agreement describes internal communications at JPMorgan expressing concerns about how Madoff was generating his purported returns. As early as 1998, a JPMorgan fund manager wrote that the returns were “possibly too good to be true” and there were “too many red flags.”

In more recent years, executives were disturbed by the fact that Madoff wouldn’t let the bank examine his books, according to the statement of facts.

“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” but didn’t believe any of its employees knowingly assisted the scam.

“Madoff’s scheme was an unprecedented and widespread fraud that deceived thousands, including us, and caused many people to suffer substantial losses,” the statement said.

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 68 cents to $58.32 in 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.

Madoff, 75, pleaded guilty and is serving a 150-year prison term.

When his scam unraveled, account statements for thousands of his clients showed $60 billion in assets. In reality, the roughly $17.5 billion in principal they gave him was almost gone.

A court-appointed trustee has recovered more than $9.78 billion — including a portion of the JPMorgan civil payout — to redistribute to clients that invested directly with Madoff. The $1.7 billion criminal forfeiture and will go to a second victims’ pool, already with $2.35 billion, that is processing claims from clients of so-called “feeder funds” that also invested heavily with Madoff.

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 the U.S. attorney in Sacramento, Calif.

The more than $2 billion that JPMorgan is paying is about 10 percent of the bank’s $21.3 billion net income reported for 2012. It already has set aside $23 billion this year to cover settlement and litigation costs — including the $13 billion it agreed to pay in November in a settlement with the Justice Department over its sales of risky mortgage securities before the financial crisis struck.