Forty-nine states and five major banks reached a $26 billion mortgage settlement that will aid about two million homeowners, government officials announced Thursday.

California and New York's state attorneys general had resisted the deal, but eventually joined, boosting the settlement amount from around $19 billion to $26 billion.

"This is a strong, balanced agreement," said Iowa State Attorney General Tom Miller during a press conference Thursday. "There's teeth. There's regulation in there."

The settlement grew out of a 16-month investigation into improperly foreclosure processing, which revealed that banks had signed documents with minimal reviews, known as robo-signing.

The lenders include Ally Financial, Bank of America, Citigroup, JPMorgan Chase and Wells Fargo. The banks have already set aside reserves to settle the claims.

Payments from the banks would go towards principal reductions for borrowers who have mortgages that are greater than their homes' value, as well as those who have lost homes to foreclosure. If more banks join the deal, the total settlement could rise over $40 billion.

The Center for Responsible Lending, a consumer advocacy group, supported the deal. "The settlement would include key reforms to clean up unfair mortgage servicing practices," the group said in a statement last month. "It would also provide an important template for ways banks can use principal reduction to reduce unnecessary foreclosures and put the country back on a path to economic recovery."

The banks remain targets for additional litigation related to mortgage and foreclosure claims, which may dampen relief that the settlement has been reached for investors.

"We believe any initial euphoria over the deal will quickly fade as investors realize the flood of additional mortgage-related litigation that the major banks face," said analyst Jaret Seiberg of Guggenheim Partners in a research note on Thursday.

A lawsuit filed last week by New York State Attorney General Eric Schneiderman against Bank of America, JPMorgan Chase and Wells Fargo will also be allowed to continue.

Oklahoma is the only U.S. state not participating in the deal. It is negotiating a separate settlement.