Barclays Capital has agreed to pay a fine of around $2bn to the US Department of Justice (DOJ) to settle allegations of fraud in underwriting and issuance of residential mortgage-backed securities (RMBS) before the financial crisis.

The settlement follows a three year probe that revealed that the company caused billions of dollars in losses to investors by fraudulently selling 36 RMBS deals worth over $31bn between 2005 and 2007.

The civil complaint, filed in December 2016, also accused the company of misleading investors about the quality of the mortgage loans backing the deals.

US attorney Richard Donoghue said: “This settlement reflects the ongoing commitment of the Department of Justice, and this Office, to hold banks and other entities and individuals accountable for their fraudulent conduct. The substantial penalty Barclays and its executives have agreed to pay is an important step in recognising the harm that was caused to the national economy and to investors in RMBS.”

In addition, the DOJ also agreed a $2m settlement with two former Barclays executives- Paul Menefee and John Carroll- over their roles in the sale of RMBS.

Menefee was the lead banker of the company’s subprime RMBS securitisation division, while Carroll served as the head trader for subprime loan acquisitions.

Last month, UBS reached a $230m settlement with the New York state to resolve similar allegations related to RMBS.