After a three-year investigation, the Justice Department said Thursday that it had reached a $2 billion settlement with Barclays, a giant British bank that federal prosecutors say sold toxic mortgages that contributed to the global financial crisis.

Prosecutors say that between 2005 and 2007, Barclays sold investors packages of mortgages that were worth less than the bank claimed, costing the investors billions of dollars. More than half of the $31 billion in mortgage packages eventually defaulted, prosecutors said. The settlement “is an important step in recognizing the harm that was caused to the national economy,” Richard Donoghue, U.S. attorney for the Eastern District of New York, said in a statement.

But, for Barclays, the settlement may also be a triumph. The multibillion-dollar penalty could have been much bigger, industry analysts say. The bank also didn’t have to admit wrongdoing.

“The settlement came at the bottom end of expectations and much sooner than expected,” Ian Gordon, an analyst at Investec, said in a research note, according to Bloomberg.

Barclays is paying much less than some other big banks that have faced similar allegations paid. In 2013, JPMorgan Chase paid $13 billion. In 2014, Bank of America agreed to a record-setting $16 billion settlement. Deutsche Bank paid $7 billion earlier this year.

Unlike many of those big banks, Barclays initially balked at paying a large fine. The Justice Department under the Obama administration was asking for as much as $8 billion from the British bank, according to industry analysts and media reports at the time. The Wall Street Journal reported then that the bank was being asked to pay about $5 billion. But Barclays wanted to pay much less, $1.5 billion to $2 billion, according to various media reports.

When they couldn’t reach an agreement, the Justice Department took the unusual step of suing Barclays in the waning days of the Obama administration. Then-Attorney General Loretta Lynch lashed out at the bank. “Barclays jeopardized billions of dollars of wealth through practices that were plainly irresponsible and dishonest,” she said.

But Barclays vowed to fight the lawsuit, saying it had an obligation to its shareholders to defend itself against “unreasonable allegations and demand.”

Barclays recently approached the Justice Department to restart negotiations, according to two people familiar with the matter, who were not authorized to speak publicly.

In a statement Thursday, Barclays chief executive Jes Staley said he was pleased to reach a “fair and proportionate settlement,” adding, “It has been a priority for this management team from the start to resolve these historic issues in a timely and appropriate manner wherever possible.”

The Justice Department also extracted $2 million from two former Barclays executives, Paul Menefee and John Carroll. But neither admitted wrongdoing, and both remained defiant despite the settlement. In a statement, Carroll’s attorney called the allegations “meritless.” “John Carroll is pleased that the Government has relented in its efforts to prove wrongdoing where none exists,” the attorney said.

Menefee agreed to settle the case so he could put the matter behind him, his attorneys said in a statement. “Paul Menefee has always maintained that the government’s lawsuit against him was baseless and should never have been brought,” attorneys Barry Berke and Dani James said. “As a Managing Director at Barclay’s Capital Inc., Mr. Menefee worked tirelessly, diligently and in good faith at all times on behalf of Barclays and its investors.”

Only subscribers are eligible to post comments. Please subscribe or to participate in the conversation. Here’s why.

Use the form below to reset your password. When you've submitted your account email, we will send an email with a reset code.