Bank of America announced Thursday morning it has agreed to pay a record $16.65 billion to resolve claims related to the sale of the sale of toxic mortgage-backed securities during the years leading up the financial crisis.

The settlement, which comes after months of reportedly heated negotiations, is the largest civil settlement with a single entity in the history of the United States, eclipsing last year’s record-setting $13 billion agreement between the U.S. Department of Justice and JPMorgan Chase. That settlement was over similar matters.

According to the announcement, Bank of America has agreed to pay a total of $9.65 billion in cash to the Justice Department, various federal regulators, and the states of California, Delaware, Illinois, Kentucky, Maryland, and New York.