Bank of America has reached a $10bn agreement with mortgage agency Fannie Mae to settle claims the bank sold the US government-sponsored enterprise toxic mortgage bonds in the eight years leading up to the global financial crisis.

The country's second-largest lender by market value, Bank of America will pay $3.6bn in cash to the Federal National Mortgage Association, and has also agreed to buy back 30,000 mortgages for $6.75bn.

Fannie Mae had argued that both Bank of America and its Countrywide Financial unit had sold it thousands of toxic home loans between 2000 and 2008.

Both Fannie Mae and the other government supported mortgage agency Freddie Mac lost more than $30bn partly because of their investments in the subprime mortgages, and were consequently bailed out by the US government. Since then, US taxpayers have spent around $190bn to keep the two firms afloat. Bank of America settled with Freddie Mac in 2011.

In a statement on the company's website, Bank of America Chief Executive Officer Brian Moynihan said

"As we enter 2013, we sharpen our focus on serving our three customer groups and helping to move the economy forward.

"Together, these agreements are a significant step in resolving our remaining legacy mortgage issues, further streamlining and simplifying the company and reducing expenses over time."

In October, the US government sued Bank of America, as well as JP Morgan Chase and Wells Fargo, for alleged mortgage fraud.

Written and presented by Alfred Joyner