Two years after reaching a landmark $8.5 billion legal settlement, Bank of America (BAC) once again threatened this week to put its litigation-riddled mortgage division Countrywide Financial into bankruptcy.

The threat highlights the level of legal headaches still surrounding the purchase of Countrywide, which had been teetering on the brink of collapse during the 2008 financial crisis before BofA swooped in with a rescue.

At a New York state court hearing on Monday, BofA Chief Risk Officer Terrence Laughlin said the banking giant could put Countrywide into bankruptcy if it fails to win court approval for the $8.5 billion settlement with mortgage investors who claim the company misrepresented mortgages at the heart of bond deals, Reuters reported.

BofA similarly threatened to have Countrywide file for bankruptcy as the bank hammered out the settlement in June 2011 with institutional investors like BlackRock (BLK) and MetLife (MET).

Now American International Group (AIG) and others are challenging that $8.5 billion settlement as inadequate.

"One of the options that was available to us and continues to be available to us was to put Countrywide into bankruptcy," Laughlin said at the hearing, the wire service reported.

The BofA exec denied that he or anyone else at the lender had talked to the Office of the Comptroller of the Currency, BofA's regulator, about a Countrywide bankruptcy.

Shares of Charlotte-based BofA retreated 1.05% to $13.15 Tuesday morning amid a 1% drop on the S&P 500.

Follow Matt Egan on Twitter @MattMEgan5