to save the housing sector. it turned out in the end the gov't even made some money out of it. the reason is very simple: not all of the mortgage backed securities are bad. as a matter of fact, most of the alt a level assets are still worth something. the problem is they are so complicated and nobody knows how much they worth. but if you hold them to maturity you will actually recoup most of the investment. The foreclosure rate is around 2% of the entire mortgage.
the main problem is the lossing of liquidity. which is equal to lossing of confidence to the credit market.
in the long run, the bad asset bank should not lose money. it may even make money because the cost of capital for the gov't is much lower than that for the banks.