Goldman Sachs raises its range of potential legal costs to $5.9 billion

Goldman Sachs Group Inc. raised the upper end of its estimate for "reasonably possible" legal expenses to $5.9 billion, according to a regulatory filing.

That is up from its prior upper estimate of $3.8 billion in May comes as the financial firm revealed in the same filing that it was discussing a potential resolution with authorities over risky mortgage-backed securities.

During the quarter, the company set aside $1.45 billion for a potential settlement. It noted in the legal filing that any resolution could result in costly penalties.

Mortgage-backed securities soured after the housing bubble burst in 2007, losing billions in value. That plunged the economy into the deepest recession since the Great Depression.

In August of 2014, Goldman Sachs agreed to a settlement worth $1.2 billion to resolve claims that it misled U.S. mortgage giants Fannie Mae and Freddie Mac about risky mortgage securities it sold them before the housing market collapsed in 2007. Under that settlement, Goldman paid $3.15 billion to buy back the securities from Fannie and Freddie. The settlement amount reflected the difference between what Goldman paid and the value of the securities.

A number of big banks, including Goldman, JPMorgan, Bank of America and Citigroup, have been accused of abuses in sales of securities linked to mortgages. Many of those banks have either paid settlements or struck deals to make settlements ranging into the billions of dollars.