Barclays Capital, which was accused in a lawsuit filed by the U.S. government of taking part in a scheme that caused billions in losses to investors in residential mortgage-backed securities, has agreed to a $2 billion settlement in the case.

The British bank and two of its former executives—Paul Menefee, its lead banker for its subprime RMBS, and John Carroll, the bank’s lead trader for subprime loan acquisitions—were accused of misleading investors from 2005 to 2007 about the quality of 36 RMBS that were propped up with more than $31 billion in subprime loans.