LONDON (MarketWatch) -- The U.S. government on Friday announced it was injecting $20 billion into Bank of America and guaranteeing losses on over $400 billion of assets both the Charlotte, N.C. lender and Citigroup.

In a statement released Friday, the Treasury Department and the Federal Deposit Insurance Corporation said they will invest $20 billion in Bank of America BAC, -1.32% from the Troubled Assets Relief Program in exchange for preferred stock paying an 8% dividend.

The news lifted Bank of America shares in pre-open trading, as investors welcomed clarity on an issue whose uncertainty had sparked high volatility and big losses in the company's shares.

In fact, Bank of America moved up its fourth quarter earnings release and its unveiling of the government plan by a few days in response to the market action.

Also Friday, Bank of America BAC, -1.32% said it swung to a fourth-quarter loss of $1.79 billion, or 48 cents a share, on escalating credit costs, including additions to reserves, and significant writedowns and trading losses in the capital markets businesses. See full story.

Bank of America shares traded up 5.5%, to $8.79 in pre-open trading.

However, even as the shares rose, Bank of America CEO Ken Lewis expressed continuing concern about the business bad economic environments.

Lewis told investors during a conference call to discuss the results that he expected the U.S. economy to show "some potential signs of stabilization during the second half of" 2009. Those comments amount to a shift in economic forecasting for Lewis, who had long maintained, until Friday, that the economy would start to recover around the middle of 2009. See full story

The government also will provide Bank of America protection against the possibility of unusually large losses on an asset pool of approximately $118 billion of loans, securities backed by residential and commercial real estate loans and other such assets, which have been marked to current value.

Bank of America will absorb the first $10 billion of losses while the government will share losses from there, up to $10 billion. If that pool of assets sees losses of over $20 billion, then the government will absorb hits on 90% of them.

A similar guarantee was provided to Citigroup: Uncle Sam is on the hook for $301 billion of assets, with Citi C, -2.12% taking the first $39.5 billion of hits, and then the government absorbing 90% of the rest.

Citigroup said this finalized what was announced with the government on Nov. 23.

The Federal Reserve also is ready to backstop "residual risk in the asset pool" if necessary.

The government relief comes as Bank of America stock skidded to a 17-year low, following Thursday's report in The Wall Street Journal that such a relief program was near. Investors were unnerved by the additional losses at Merrill Lynch.

Both Bank of America and Citigroup C, -2.12% detailed billions of dollars during the fourth quarter, and that doesn't even include the estimated $15 billion of losses from Merrill Lynch.

Separately, the FDIC said it's going to extend its temporary liquidity guarantee program to up to 10 years, from a current three years.

"With these transactions, the U.S. government is taking the actions necessary to strengthen the financial system and protect U.S. taxpayers and the U.S. economy," the government said.