An Occupy Wall Street activist places tape on a boarded-up house during a tour of foreclosed homes in Brooklyn, N.Y., in December 2011.

WASHINGTON — Goldman Sachs and Morgan Stanley will pay a combined $557 million to settle federal complaints that they wrongfully foreclosed on homeowners who should have been allowed to stay in their homes.

The agreements announced Wednesday with the Federal Reserve were similar to deals struck earlier this month with 10 other major banks and mortgage lenders. Combined, the 12 firms will pay more than $9 billion.

Goldman will pay $330 million. Morgan Stanley is paying $227 million.

The settlements could compensate hundreds of thousands of Americans whose homes were seized because of abuses such as “robo-signing,” when banks automatically signed off on foreclosures without properly reviewing documents. The agreement will also help eliminate huge potential liabilities for the banks.

Under the settlement, Goldman and Morgan Stanley will pay a combined $232 million in cash compensation to homeowners to end an independent review of loan files required under a 2011 action by the Fed and the Office of the Comptroller of the Currency. The remaining $325 million will be used to reduce mortgage balances and to forgive outstanding principal on home sales that generated less than borrowers owed on their mortgages.

About 220,000 people whose homes were in foreclosure in 2009 and 2010 are eligible for payments under the deal with the two banks, the Fed said. The payments could range from hundreds of dollars up to $125,000, depending on the type of possible error.

Spokesmen for both Goldman and Morgan Stanley said the banks are pleased to have the matter settled.

The structure of the deal is nearly identical to the $8.5 billion settlement announced last week with Bank of America, JPMorgan Chase, Wells Fargo, Citigroup, MetLife Bank, PNC Financial Services, Sovereign, SunTrust, U.S. Bank and Aurora.

Those banks are paying about $3.3 billion to 3.8 million homeowners to end the review of foreclosures. The rest — $5.2 billion — is going toward mortgage modifications and principal forgiveness.

Two other banks were subject to the 2011 independent reviews. HSBC and Ally Financial have been in discussions with regulators on similar settlements but have yet to reach deals.

Banks and consumer advocates had complained that the loan-by-loan reviews required under the 2011 order were time-consuming and costly and didn’t reach many homeowners. Banks were paying large amounts to consultants to review the files. Some questioned the independence of those consultants, who often ruled against homeowners.

The settlements don’t close the book on the housing crisis, which brought more than 4 million foreclosures. They cover only borrowers who were in foreclosure in 2009 and 2010. And resolving millions of claims involving multiple banks and mortgage companies is complicated and time-consuming.

The deals announced this month are separate from a $25 billion settlement struck last February with five major banks by the federal government and 49 states. Those banks are Ally, Bank of America, Citigroup, JPMorgan and Wells Fargo.