CapitalSource is acquiring the retail banking operations of Fremont General for $170 million after the troubled lender was hit hard by the subprime mortgage-led crisis.

The sale includes $5.6 billion in deposits, $3 billion in cash and liquid investments and Fremont's $2.7 billion stake in commercial real estate loans, Fremont said in a statement today. The firm said it's paying $58 million; add an additional 2 percent of the $5.6 billion in deposits, for a total of $170 million.

CapitalSource , a commercial lending, investment and asset management business focused on medium-sized firms, will have access to 22 Fremont retail branches.

CapitalSource also agreed to lend the banking business as much as $200 million. It plans to form a new California-chartered industrial bank.

We have long sought deposit funding as a way to further diversify and strengthen our funding platform, CapitalSource Chief Financial Officer Thomas Fink said in a statement.

Fremont faced a May 26 deadline from regulators to get new funds for the bank or find a buyer. The company said today it may need to file for bankruptcy if it can't arrange a shareholder vote on the matter.

The company said on March 4 that it may be forced out of business due to contracts tied to subprime mortgages and has delayed interest payments on some debts it owes. The total was $3.15 billion in subprime mortgages it sold to investors a year ago.

The deal is scheduled to close in the third quarter.

The deal enhances our liquidity in what is potentially, over time, a game-changing manner,'' said CapitalSource Chief Executive Officer John Delaney on a conference call today.

It will lower our cost of funds over time, which will lead to improved profitability. he added.