The TARP program was nevertheless necessary to keep banks from collapsing in a cascade of failures.