JPMorgan Chase may have reached a settlement with the Justice Department over all civil mortgage-bond-related matters for $13 billion. Reuters

JPMorgan Chase & Co (NYSE:JPM) has tentatively reached a settlement with the Justice Department over all residential mortgage-bond-related matters, a source familiar with last night’s talks said Saturday, according to Reuters.

The New York Times reports this is a “record penalty” that would end weeks of intense talks and highlight the bank’s extensive legal woes.

Previously, JPMorgan had offered to pay $11 billion in penalties for shoddy mortgage-backed securities. The bank refused to increase its offer unless the Justice Department agreed to stop its criminal investigation into the bank’s sale of these securities.

U.S. Attorney General Eric Holder reportedly told JPMorgan Chief Executive Officer Jamie Dimon that any deal would not include absolving the company of potential criminal liability. Eventually, the bank backed down. This marks a “major victory for the government,” the New York Times noted.

CNBC reports that JPMorgan also reached a tentative $4 billion deal with the U.S. Federal Housing Finance Agency. The deal reportedly settles claims that the bank lied to government-sponsored mortgage agencies, Fannie Mae and Freddie Mac, about the quality of mortgages it sold them during the real estate bubble.

The $4 billion deal with the housing agency is part of the possible $13 billion settlement.

Negotiations between JPMorgan and the Justice Department aren’t final just yet, and could still fall through.

Dimon’s troubles extend far beyond the $13 billion settlement with the Justice Department. International Business Times reported that the JPMorgan CEO is also fending off accusations of bribery and nepotism after the bank hired the children of influential Chinese politicians, a violation of the Foreign Corrupt Practices Act.

Additionally, the bank paid $410 million in fines to the U.S. Federal Energy Regulatory Committee for influencing energy markets.