Image copyright Getty Images Image caption Goldman Sachs' chairman and chief executive, Lloyd Blankfein, announced the deal

Goldman Sachs says it has reached a deal with US authorities over charges that it used fraudulent marketing material to sell mortgage bonds before the financial crisis.

The bank agreed to pay $5.1bn (£3.5bn) in civil penalties and consumer relief.

The tentative deal was reached with the US Department of Justice's Financial Fraud Enforcement Task Force.

The task force has been investigating how banks advertised risky financial products before the financial crisis.

Goldman Sachs' chairman and chief executive, Lloyd Blankfein, said in a statement: "We are pleased to have reached an agreement in principle to resolve these matters."

The deal stems from an investigation into Goldman Sachs' securitisation, underwriting and sale of residential mortgage-backed securities (RMBS) from 2005 to 2007.

Goldman Sachs is one of several banks that have been fined billions of dollars for marketing RMBS as a safe investment in the run-up to the financial crisis.

The sale of RMBS played a significant role in the 2008 crisis. US banks have taken much of the blame for granting mortgages to unqualified borrowers, then repackaging those loans as safe investments and selling the risk on to others.

The deal settles civil claims from the Justice Department, the New York and Illinois Attorneys General, the National Credit Union Administration and the Federal Home Loan Banks of Chicago and Seattle.

The agreement is still subject to negotiations over certain documentation.

Goldman Sachs has warned the deal will reduce its fourth-quarter earnings by $1.5bn.