Goldman Sachs Group has agreed to a tentative $5.1bn (£3.55bn) settlement following a federal and state investigation of the investment bank's handling of mortgage-backed securities which led to the housing bubble and the subsequent national financial crisis.

The bank announced the settlement which comprises a $2.385bn (£1.60bn) civil penalty, an $875m (£608m) cash payment and $1.8bn (£1.2bn) in relief for homeowners whose mortgages exceed the value of their property as well as distressed borrowers.

The settlement would reduce Goldman's fourth-quarter 2015 earnings by approximately $1.5bn (£1.04bn) on an after-tax basis.

"We are pleased to have reached an agreement in principle to resolve these matters," Goldman Chairman and CEO Lloyed Blankfein said in a statement. The deal is still to be finalised by regulators and other bodies.

Various government agencies have been working together as part of a joint state-federal task force created by President Barack Obama to look into the 2008 financial crisis better known as the Great Recession.

A number of investment banks sold mortgages to people who could not afford them and then wrongly advised investors to put their money in the same securities by misleading them regarding the safety of the schemes.

Goldman along with Wall Street banks like Bank of America and JP Morgan Chase have been investigated for allegedly misleading investors. The investigations have led to some of Wall Street's biggest settlements.