JPMorgan Chase (JPM) posted a third-quarter net loss of $380 million on Friday as it continued to battle a slew of regulatory and legal issues. The bank’s third-quarter earnings hit $5.8 billion, or $1.42 a share, while revenue fell to $23.9 billion from $25.9 billion in the same period a year earlier. Per the New York Times.

Mortgage origination demand dropped 14% from a year earlier to $40.5 billion. However, mortgage banking income reached $705 million for the third-quarter, up 13% from the year ago period.

JPMorgan’s earnings were eroded, in large part, by a legal expense of $9.2 billion.

“While we had strong underlying performance across the businesses, unfortunately, the quarter was marred by large legal expense,” Jamie Dimon, the bank’s chief executive, said in a statement.