A federal judge ordered Bank of America to pay $540.3 million in a long-running Federal Deposit Insurance Corporation lawsuit accusing the second-largest U.S. bank of underpaying what it owed for deposit insurance.

The FDIC sued Charlotte, North Carolina-based Bank of America for $1.12 billion in 2017, accusing it of reducing its deposit insurance contributions by failing to honor a 2011 rule that changed how banks report risk exposure to counterparties.

That rule was one of many federal reforms designed to ensure the stability of the banking system, and avert a repeat of the 2008 global financial crisis.

In a 59-page decision, AliKhan rejected Bank of America’s claims that there was no reasonable basis for the rule, and that the FDIC acted arbitrarily and capriciously.

AliKhan said the FDIC was not required to develop a “perfect measure” of predicting banks’ potential exposure to losses, and Bank of America could claim it “lacked fair notice of what was required of it.”