Still baffled for reason behind banks bailout

Now that all the dust has settled, can anyone explain to me why the banks needed a bailout?

A large number of mortgages were bundled and sold as securities, so the banks got paid for them.

Another large percentage of mortgages were covered by VA, FHA, HUD or PMI insurance, so the banks got reimbursed for them. Not all the loans went bad, so no losses were incurred. During this same period banks raised fees for banking transactions, ATM cards, etc. So will someone please explain to me why they needed a bailout?

George Johnson