The U.S. Congress on Tuesday sent President Barack Obama a housing rescue bill that aims to save 400,000 homeowners from foreclosure and will spend $2.2 billion on programs to aid the homeless.

Lawmakers have spent weeks trying to hash out a compromise bill to try to help stem a three-year-long housing crisis that has seen record defaults and double-digit home price declines.

The measure includes direct aid to those hardest hit by the

housing crisis but also tries to stabilize the broader financial markets.

Washington's rescue program for bank customers - the Federal Deposit Insurance Corp. - would be expanded so that lenders may access a new government credit line.

The FDIC has been able to tap the Treasury Department for up to $30 billion since 1991 but that credit line would be permanently increased to $100 billion and go temporarily higher to $500 billion through the end of next year.

For consumers, the bill will retool a federal program that refinances troubled homeowners, inject cash into the largest federal homeless aid program and let tenants who face eviction because of a landlord's default serve out the rest of their lease.

Both the U.S. Senate and House of Representatives have passed their own versions of reform and both chambers gave their final approval on Tuesday.

Democrats wanted the bill to clear Congress on Tuesday so that they may present it to President Barack Obama and boast about a legislative victory before they take a week-long vacation.

All of these provisions are valuable steps against the foreclosure epidemic, House Majority Leader Steny Hoyer of Maryland said in a statement. Passing this bill is an important part of our economic recovery, and I look forward to seeing President Obama sign it.

LEGISLATION TRIMMED DOWN

The legislation's scope has significantly narrowed in recent months as proponents sought to broaden its appeal.

A provision that would have let bankruptcy judges erase some mortgage debt was scrapped and the bill does not include broader mortgage lending reform sought by Representative Barney Frank, chairman of the House Financial Services Committee.

Bank of America, JPMorgan Chase and Wells Fargo & Co led the effort to strike the bankruptcy provision, which would have let judges cramdown the amount of an outstanding mortgage loan.

The banks who brought us this crisis in America have resisted this chance to do something about mortgage foreclosure, Senator Richard Durbin, an Illinois Democrat, said of the provision that failed in late April.

Lenders warned that investors would be spooked by the uncertainty of giving bankruptcy judges broad new powers.

By a vote of 300-114, the House approved a measure earlier this month that would have forced mortgage lenders to retain a 5 percent stake in home loans they make, securitize and then sell to investors.

That bill, which also includes other consumer protections, is now orphaned in the Senate and so its prospects are uncertain, though Frank has said the deepening housing crisis is likely to spur passage.

The health of the housing market and potential success of the Obama housing rescue plan will dictate what happens from here, said Brian Gardner, vice president at investment firm Keefe Bruyette & Woods.

Foreclosures in April jumped 32 percent from a year ago with 1 in every 374 mortgage-holders receiving a notice of default, according to the real estate data firm RealtyTrac. In March, the value of existing homes was off 12.5 percent from a year earlier, the National Association of Realtors said.

The legislation would ease terms under which the Federal Housing Administration may refinance troubled borrowers so that the program may assist more households. But only a handful of borrowers have been reached by the Hope for Homeowners program since it was conceived last summer.

The FHA will claim $1.244 billion of a $700 billion government rescue fund to cover some costs of the program.

Congress authorized that rescue kitty in October and lawmakers have closely scrutinized the multibillion-dollar investments meant to stabilize Wall Street.

Officials would have to write tougher new conflict of interest rules for future rescue programs under one provision of Tuesday's bill.

The legislation would also shield mortgage finance companies from investor lawsuit if those firms ease monthly payments for troubled homeowners.