Royal Bank of Scotland will pay $4.9 billion to settle charges that it misled investors ahead of the 2008 financial crisis.

It's the largest penalty the Justice Department has imposed on a bank for crisis-era misconduct.

"This resolution — the largest of its kind — holds RBS accountable for defrauding the people and institutions that form the backbone of our investing community," Andrew Lelling, the top federal prosecutor in Massachusetts, said in a statement.

From 2005 to 2008, RBS "routinely made misrepresentations to investors" who bought securities backed by risky mortgages, concealing their high risk of default, the Justice Department said Tuesday.

The Justice Department said RBS earned hundreds of millions of dollars while investors — including mortgage giants Fannie Mae and Freddie Mac — suffered significant losses.

RBS disputes the allegations and does not admit wrongdoing, according to the Justice Department.

CEO Ross McEwan said in a statement that RBS is "pleased to have reached a final settlement."

"There is no place for the sort of unacceptable behavior alleged by the DoJ at the bank we are building today," he said.

The bank announced that it had reached an agreement with the Justice Department "in principle" in May.

In 2017, RBS agreed to pay $5.5 billion in a separate settlement with the Federal Housing Finance Agency.

This is expected to be the last major penalty for the bank for crisis-era misconduct.

It was once the biggest bank in the world but has struggled since its rescue by British taxpayers in 2008. The UK government still owns a majority stake, though the Justice Department settlement could clear the way for privatization.

The US government has reached settlements with numerous banks over their conduct before the crisis.

Earlier this month, the Justice Department hit Wells Fargo (WFC) with a $2.09 billion fine for originating and selling mortgage loans that ended up in toxic securities. The bank did not admit liability as part of the settlement.