Bank of America CEO Brian T. Moynihan

Bank of America has reached a $10bn agreement with the Fannie Mae to settle claims the bank sold the US government supported lender toxic mortgage bonds in the lead up to the global financial crisis.

Bank of America (BofA), the country's second-largest lender by market value, will pay $3.6bn in cash to the Federal National Mortgage Association (Fannie Mae) and repurchase around $6.75bn in residential mortgage bonds it sold to the agency during an eight year period ending in 2008. Collectively, the securities represent around $1.4tn worth of loan principal, around $300bn of which remains outstanding. The bank said the deal with cost around $2.5bn against its fourth quarter earnings.

"As we enter 2013, we sharpen our focus on serving our three customer groups and helping to move the economy forward," said Bank of America Chief Executive Officer Brian Moynihan in a statement on the company's website. "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."

Both Fannie Mae and Freddie Mac were taken under government control, though a process known as conservatorship, in 2008, largely on the back of concerns that their balance sheets were unable to support the massive losses suffered because of the collapse in the mortgage bond market.

Each agency has been under pressure to collect recoup losses on mortgage bonds from the biggest US lenders in order to pay back some of the $190bn in taxpayer support the pair have collectively received.

BofA, along with Wells Fargo, the biggest US bank by market value, JPMorgan Chase, Citigroup and others totalled more than $84bn, according to Bloomberg data. BofA had set aside $12.3bn as of the end of its fiscal third quarter.

The Charlotte, North Carolina- based lender was sued by the US government in October after the Justice Department claimed it and its Countrywide Financial unit duped both Fannie Mae and its sister agency, Freddie Mac, into buying billions of dollars' worth of so-called toxic mortgage bonds. The agencies regulator, the Federal Housing Finance Agency, sued BofA, Countrywide and 15 other financial institutions for losses linked to the residential mortgage backed securities.

Bank of America shares were indicated to open more than 2 percent higher than the Friday closing price of $12.11 per share however the stock gave back around 0.06 cents in trading on Wall Street to change hands at $12.05.

The stock has nearly doubled in value over the past 52 weeks, rising some 96.9 percent from a 9 January 2011 low of $6.63 each.