NEW YORK (AP) — Goldman Sachs posted a $1.93 billion in the fourth quarter, the investment bank said Wednesday, as the bank had to record more than $4 billion in charges related to the new tax law. It was the bank's first quarterly loss in more than six years.

Goldman had a net loss of $5.51 a share, compared with a profit of $2.35 billion, or $5.08 a share, in the same period a year earlier. Excluding the one-time charges, however, the bank earned $5.68 a share, beating analysts' estimates.

Like other banks, Goldman had to write down billions in assets impacted by the new tax law this quarter, resulting in the quarterly loss. It had $3.32 billion in charges related to foreign earnings now taxable under the law and $1.1 billion in charges for deferred tax assets it stockpiled after the financial crisis.

Firm-wide, net revenues at Goldman were $7.83 billion versus $8.17 billion a year earlier.

Outside of the impact of the tax bill, Goldman's results were hurt by a relatively weak performance on its trading desks, typically one of Goldman's strongest businesses.

The segment inside Goldman that contains its trading operations had net revenues of $2.37 billion in the fourth quarter, down 34 percent from a year earlier. Fixed income, currencies and commodities trading net revenues were down by 50 percent from a year earlier.

The firm's advisory businesses, however, made up for the weak performance in trading. Investment banking net revenues totaled $2.14 billion, up 44 percent from a year earlier.

The bank set aside less money per employee for compensation than it had in the past, likely due to the weak performance on its trading desks. Goldman Sachs' pay structure relies heavily on giving annual bonuses to employees based on performance. So while compensation expenses in the full year rose to $11.85 billion, up 2 percent from a year earlier, Goldman said it had six percent more staff than it did a year ago.