JPMorgan agreed a $13bn deal with US authorities which will see the bank end government civil probes into its mortgage-backed financial products (Reuters)

JPMorgan has agreed the details of a $4bn consumer relief package - including the write-down of mortgage loans, knocking down abandoned homes, and lower monthly payments for homeowners - as part of its bumper $13bn settlement with the US Department of Justice over its mortgage-backed financial products.

JPMorgan will need to spend the $4bn ($2.5bn, €3bn) by the end of 2016 and will be overseen by an independent authority as it does this, according to Reuters, which cited an anonymous source familiar with the matter. An official announcement is expected within days.

Under the $13bn deal, the agreement of which has been reported previously but is yet to be unveiled officially, JPMorgan is not free of criminal liability and will have to continue to co-operate in criminal inquiries into individuals suspected of mis-selling the toxic mortgage-backed securities that brought the entire financial system to its knees.

The bank already stumped up nearly $1bn in fines related to the London Whale trading scandal, which has cost billions of dollars in losses from a series of enormous bad market bets.

On the same day JPMorgan was ordered to refund $300m to customers after US regulators ruled that two million clients were harmed by the bank's debt collection and other credit card practices.

Regulators also said that there were errors in the way the investment bank pursued customers through the court. However the refund order is not a fine, so regulators and prosecutors can still slap JPMorgan with financial penalties in the future.

JPMorgan has also revealed a $9.2bn legal expenses tab, resulting in the US banking giant posting its first ever quarterly loss under chief executive Jamie Dimon.

The legal expenses, which worked out as $7.2bn after taxes, include money JPMorgan is setting aside for future settlements with authorities.

"While we expect our litigation costs should abate and normalise over time, they may continue to be volatile over the next several quarters," said Dimon in a statement.