Profits at Goldman Sachs (NYSE:GS) sagged at the end of 2015 under the weight of a massive $5 billion legal settlement with the Justice Department and other regulators over mortgage securities, the investment bank reported Wednesday. Net income in the fourth quarter dropped to $765 million, or $1.27 a share, down sharply from $2.17 billion, or $4.38 a share, in 2014.

The profit slump came amid a turbulent period in the markets that saw investment bank competitors struggling to lift trading revenues as investors froze up. Goldman was no exception, taking in $1.12 billion from its fixed-income, currency and commodities trading division, 8 percent less than the same quarter in 2014.

The bank posted overall fourth-quarter revenues of $7.27 billion, a near-miss from analysts' expectations of $7.28 billion, according to data from Thomson Reuters. Year-end net revenues totaled $33.82 billion in 2015, down from $34.5 billion the year before. 

One bright spot was Goldman's investment banking division, where revenues rose 7 percent year-over-year to $1.55 billion amid a boom in mergers and acquisitions. 

The legal settlement, which covered Goldman's involvement in selling mortgage-backed bonds in the lead-up to the 2008 financial crisis, chipped an after-tax $1.54 billion out of fourth-quarter earnings, the bank said. 

Despite the downbeat fourth quarter, Goldman employees have reason to cheer. Unlike other major banks — which in recent years have been cutting costs by slashing headcounts and compensation — Goldman reported slightly rising compensation in 2015. Salaries, bonuses and benefits rose to 37.5 percent as a proportion of net revenues, compared to 36.8 percent in 2014.