NEW YORK ( TheStreet) -- A sharply-worded ruling against Bank of America ( BAC - Get Report) offers a detailed and fascinating portrait of the complex dance between giant financial institutions in a crisis.

Bank of America will have to pay back $500 million plus interest, reflecting deposits it seized from Lehman Brothers two months after the securities firm's historic bankruptcy filing on September 14, 2008, U.S. bankruptcy judge James Peck ruled Tuesday. Judge Peck has still to determine whether to award further monetary damages to Lehman.

Bank of America's seizure of the Lehman funds on Nov. 10 was "an unauthorized and impermissible setoff in violation of the automatic stay" in the Lehman bankruptcy case," according to the ruling.

While the monetary damages are not insignificant, the ruling is also significant for its depiction of two of the U.S.'s largest financial players during a period investors and historians are sure to study for decades at the very least.

In normal times, Bank of America and Lehman, like many other financial giants, are each other's customers, clients and friendly (if occcasionally ruthless) competitors. In times of crisis, however, even as they depend on each other for their very survival, they are prepared to shift into kill-or-be-killed mode at a moment's notice.

According to Judge Peck's account in the ruling, Bank of America was a major clearing bank for Lehman and was accustomed to occasional intra-day overdrafts in Lehman's accounts. Bank of America routinely overlooked these negative balances, because it was used to Lehman's cash management practices and knew Lehman's account would turn positive the following day.

However, these otherwise routine intra-day overdrafts "became a major preoccupation" for Bank of America executives following a $650 million overnight overdraft in July 2008.

The overdraft was "traceable to a non-recurring error within Lehman's cash management system and promptly was cured," the judge wrote.

Nonetheless, in late August Bank of America moved to protect itself from future overdrafts by subjecting Lehman Brothers to tough new collateral requirements, among other strictures.

"Although Lehman theoretically had the discretion and ability to move its bankingrelationship elsewhere, in practical terms it would have been very cumbersome and time-consuming to replace Bank of America," the judge wrote, adding that the relationship between the two institutions "was really too big to change."

Some two months after Lehman filed for bankruptcy protection, Bank of America seized the money in the Lehman account in order to apply it "against amounts allegedly owed" by Lehman, "arising out of certain entirely unrelated derivative transactions," the judge wrote.

Judge Peck argued the action was one of a series of "surprisingly bold moves," adding that the "deliberately aggressive and calculated strategy seems to be a current example of the old aphorism that possession is nine-tenths of the law, but Bank of America's combative approach has done nothing to alter the legal analysis as to the underlying issue."

"We are disappointed with the court's decision, and we continue to believe that our actions were fully supported by well-established New York law and the unambiguous language of the Bankruptcy Code. We are considering our appellate options," Bank of America said in a statement.

Bank of America is far from the only large financial institution still battling it out in the courts over the Lehman Brothers bankruptcy.

Lehman creditors have had widely-publicized disputes with JPMorgan Chase ( JPM - Get Report) and Barclays PLC ( BCS). "Significant parties" on the committee of unsecured creditors, according to the website lehmancreditors.com include U.S. Bancorp ( USB - Get Report), Metlife ( MET - Get Report), The Bank of New York Mellon ( BK - Get Report) and Wilmington Trust Corp. ( WL), which recently agreed to be bought by M&T Bank Corp. ( MTB - Get Report).

-- Written by Dan Freed in New York.

Disclosure: TheStreet's editorial policy prohibits staff editors, reporters and analysts from holding positions in any individual stocks.