The bank said in a Thursday release that its agreement in principle will resolve actual and potential claims from the Department of Justice, the New York and Illinois Attorneys General, the National Credit Union Administration and the Federal Home Loan Banks of Chicago and Seattle.

Goldman Sachs said Thursday that its fourth-quarter earnings will take a roughly $1.5 billion hit as it has reached a nearly $5.1 billion settlement agreement in principle related to its "securitization, underwriting and sale of residential mortgage-backed securities from 2005 to 2007."

The terms of the agreement say that Goldman will pay a $2.385 billion penalty, make $875 million in cash payments and provide $1.8 billion in consumer relief. The bank said that the relief will be partly composed of principal forgiveness for underwater homeowners and distressed borrowers.

Goldman will also contribute to construction financing, affordable housing, and debt restructuring support.

Shares in the company traded slightly negative in after-hours action.

The agreement in principle is still subject to final negotiation of the documentation, the bank said.