NEW YORK – Bank of America reached an $11.6 billion settlement with government mortgage agency Fannie Mae to settle claims resulting from mortgage-backed investments that soured during the housing crash, bringing it a step closer to clearing up its legacy of bad home loans.

Under the deal announced Monday, Bank of America will pay $3.6 billion in cash to Fannie Mae and buy back $6.75 billion in loans that the bank and its Countrywide Financial unit sold to the agency from Jan. 1, 2000, through Dec. 31, 2008.

That includes about 30,000 loans. The bank is also paying $1.3 billion to the agency for failing to deal with foreclosures fast enough.

Thomas Cox, a Portland-based lawyer, helped expose a robo-signing foreclosure abuse scandal — involving five of the nation’s largest banks — that led to Maine receiving a $6.9 million last year, its share from a national landmark settlement.

Cox said the Bank of America settlement could lead to mortgage principal reductions for some Maine homeowners. He said it is too early to know how many people might be affected.

The settlement over the mortgage investments represents a “a significant step” in resolving the bank’s remaining mortgage problems, Bank of America CEO Brian Moynihan said in a statement. Moynihan’s predecessor, Ken Lewis, bought Countrywide, a troubled mortgage-lending giant, in July 2008 just as the financial crisis was taking hold.

The settlement represents “another step closer to normal” for Bank of America, Wells Fargo analyst Matt Burnell wrote in a note to clients. Burnell said the deal was good for the bank because it resolved a dispute with a government agency and will likely reduce the provisions it has to set aside to cover claims from investors over faulty mortgages that were sold with incorrect data on home values or income.

Bank of America’s acquisition of Countrywide was initially praised by lawmakers because the lender was seen as stepping in to support the mortgage industry. However, instead of boosting Bank of America’s mortgage business, the purchase has drawn a drumbeat of regulatory fines, lawsuits and losses.

Fannie Mae and Freddie Mac buy mortgages from banks and package them together as bonds that they sell to investors. During the housing boom, banks sold loans to the two agencies that should never have been issued, because the banks failed to carry out the necessary diligence before making them. For example, banks sometimes failed to adequately check whether customers had stated their income correctly.

The government agencies, which were effectively nationalized in 2008 when they nearly collapsed under the weight of their mortgage losses, have been demanding that banks buy back some of the mortgage-backed investments.

In September, Bank of America also agreed to pay $2.43 billion to settle a class-action lawsuit related to its takeover of Merrill Lynch, another of Lewis’s acquisitions during the financial crisis.