Bank of America Corp. (BAC) filed a lawsuit against Colonial BancGroup Inc. (CNB) to protect its claim on Colonial loans in the face of the Alabama bank's struggle to survive.

Bank of America, of Charlotte, acted as trustee for parties that provided funding for Colonial's mortgage business, which is deeply entangled with Taylor, Bean & Whitaker Mortgage Corp., a Florida home-loan provider that ceased most operations last week.

In a complaint filed Wednesday with the U.S. District Court of the Southern District of Florida, in Miami, Bank of America said Colonial received from Freddie Mac (FRE) proceeds in excess of $1 billion from loans funded with the help of Bank of America.

At the heart of Bank of America's complaint is Taylor Bean unit Ocala Funding LLC. Ocala holds residential mortgages that are sold to Freddie Mac, and Bank of America is Ocala's custodian, indenture trustee, and collateral agent.

Give the doubts about Colonial's ability to fend off bankruptcy protection, Bank of America demanded the Ocala loans, financed through Colonial, as collateral for the proceeds Colonial allegedly didn't pay. Colonial has so far refused to provide the loans, the complaint alleges.

Bank of America isn't looking for cash, but wants to secure the loans as collateral in case of Colonial's bankruptcy. "We are doing our job as trustee," a Bank of America spokesman said.

Lisa Free, Colonial's director of investor relations, refused to comment.

Bank of America alleges, among other claims, breach of contract, unjust enrichment, and civil theft against Colonial and 10 individuals collectively referred to as John Doe.

Colonial is crucially short of capital, facing criminal charges by the Department of Justice, and acting under cease-and-desist orders from its regulators, which are deciding whether the Federal Deposit Insurance Corp. should take the bank into receivership.

Over the past decade, Colonial grew from a small regional bank to one of the nation's largest provider of funds for real estate loans originated by other banks and mortgage firms. It forged a close relationship with Taylor Bean, which earlier this year was willing to provide Colonial with a capital infusion. The deal fell apart, and last week Taylor Bean closed its mortgage-lending business.

Colonial shares were down 2 cents at 50 cents around midday Thursday in New York. Bank of America shares were up 4.8% at $16.69 amid a general increase for banking sector stocks.

-By Matthias Rieker, Dow Jones Newswires; 212-416-2471; matthias.rieker@dowjones.com

(Marshall Eckblad contributed to this report.)