NEW YORK (CNNMoney.com) -- The House on Wednesday voted 272-152 to pass sweeping legislation that will offer up to $300 billion in assistance to troubled homeowners and throw government support behind mortgage finance giants Fannie Mae and Freddie Mac.

The nearly 700-page measure will now go back to the Senate, where final passage is expected. It's not clear when the vote will occur because of a Republican filibuster threat.

The legislation has won the support from key senators in both parties, and on President Bush withdrew his long-standing veto threat on Wednesday. "The positive aspects of the bill are needed now to increase confidence and stability in the housing and financial markets," White House spokeswoman Dana Perino said.

The legislation is the centerpiece of Washington's efforts to address the nation's housing meltdown.

"This is the most important piece of housing legislation in a generation," said Senate Banking Committee Chairman Christopher Dodd, D-Conn., who led the Senate's efforts on the bill.

Critics find much to dislike about the multi-pronged plan. They argue, for example, that the bill gives "a blank check" to the Treasury to spend on helping Fannie and Freddie, despite assurances from Treasury Secretary Henry Paulson and Democratic leaders that the authority granted Treasury by the bill is unlikely to be used.

Supporters note that while no one likes every provision in the bill, the housing crisis and market instability demand action.

"This isn't a perfect solution by any means," said Rep. Barney Frank, D-Mass., chairman of the House Financial Services Committee. But, he added, it enjoys support from a broad and unlikely coalition, including bankers, housing advocates and governors and mayors struggling with the foreclosure crisis.

Over the past year, housing prices have fallen more than 15% nationwide, according to the S&P/Case-Shiller Home Price Index. More than 340,000 have had their homes repossessed by banks during the first six months of the year, up 136% from the same period in 2007. The number of delinquent mortgage holders during the same period has risen to 1.4 million, up 56% from a year earlier.

"Enactment of the bill is too politically important to both parties for either side to let the legislation die," said Jaret Seiberg, a financial services analyst for the Stanford Group, a Washington policy research firm.

Boosting Fannie and Freddie

To help stabilize markets, which were shaken in the past few weeks by steep declines in the stock prices of Fannie Mae (FNM, Fortune 500) and Freddie Mac (FRE, Fortune 500), Treasury Secretary Paulson asked Congress on July 13 to give the Treasury power to provide a liquidity and capital "backstop" for the two companies.

Fannie and Freddie guarantee the purchase and trade of mortgages and own or back $5.2 trillion in mortgages.

The bill allows Treasury over the next 18 months to offer Fannie and Freddie an unlimited line of credit and the authority to buy stock in the companies if necessary.

Shares of Fannie closed 12% higher and those of Freddie 9% on Wednesday. Fannie's stock is down 79% and Freddie's 84% over the past year.

"This [backstop] sends a signal ... to help calm the market, that we'll not walk away," said Sen. Richard Shelby, R-Ala., the lead Republican on the Senate Banking Committee.

Shelby, saying the country is "in a real crisis," has long advocated for stricter oversight of Fannie and Freddie. "I believe if we'd pushed the GSE legislation four or five years ago, we wouldn't be here today," he said.

Both critics and supporters of the Paulson plan have expressed concern that loaning or investing money in the companies could leave taxpayers with a fat bill to pay.

In a speech in New York on Tuesday, Paulson characterized the proposal as a way to support Fannie and Freddie and bolster the capital markets and economy.

"The best way to protect the taxpayer is to have very flexible powers which are temporary," Paulson said.

While the bill sets parameters on the Treasury's authority, it doesn't necessarily force its hand, Seiberg said. For instance, the measure requires the Treasury to take into consideration the need that it should be given priority over other GSE investors when it comes to being paid back. But "consideration" means "the Treasury has discretion in what it can seek. It doesn't have to ensure it gets paid back first," Seiberg said.

The Congressional Budget Office on Tuesday estimated the potential cost of a rescue could be $25 billion. CBO said there is probably a better than 50% chance that Treasury would not need to step in. It also said there is a 5% chance that Freddie and Fannie's losses would cost the government $100 billion.

Helping at-risk borrowers

The bill also aims to help homeowners at risk of foreclosure and to bolster regulation of Fannie and Freddie. Among other things, it would:

Increase the Federal Housing Administration's role. The FHA could insure up to $300 billion in new 30-year fixed rate mortgages for at-risk borrowers in owner-occupied homes if lenders agree to write down loan balances to 90% of the homes' current appraised value.

Lenders would also agree to pay upfront fees to the FHA equal to 3% of a home's appraised value. Borrowers must agree to pay an annual premium to the FHA equal to 1.5% of their new loan balance. They must also agree to share with the government any profit they realize from selling or refinancing.

The cost of the new FHA program - which would begin on Oct. 1 and be in place for just a few years - would be funded by fees from Fannie and Freddie.

While the bill authorizes the FHA to insure up to $300 billion in loans, the CBO estimates that the agency is only likely to insure up to $68 billion and help keep roughly 325,000 people in their homes. Those estimates were based on the CBO's assessment of who is likely to qualify under the program and who is likely to default and lose their home anyway despite being in the program.

Steve Preston, secretary of the Department of Housing and Urban Development, which oversees FHA, called the bill "a mixed bag." He said in a statement that the measure "ties our hands" by making it impossible for FHA to charge higher rates to riskier borrowers. The bill calls for a 12-month moratorium on so-called risk-based pricing for FHA loans.

"Now, FHA will be required to increase prices on all customers or eliminate its refinancing program for subprime borrowers at a time when they need it the most," Preston said.

Establish a stronger regulator for the GSEs. The new regulator will have a greater say over how well funded the agencies are - a major concern in the markets that has sent stocks in both companies plunging.

Permanently increase "conforming loan" limits. The bill would permanently increase the cap on the size of mortgages guaranteed by Fannie and Freddie to a maximum of $625,000 from $417,000.

The FHA maximum loan limits for high-cost areas would also increase to $625,000. Higher loan limits will make it easier for borrowers to get mortgages, because they're more likely to be traded if they are considered conforming.

Create home-buyer credit. The bill includes a tax refund for first-time home buyers worth up to 10% of a home's purchase price but no more than $7,500.

The refund, however, serves more as an interest-free loan, since it would have to be paid back over 15 years in equal installments. It would be reduced gradually for single filers with adjusted gross incomes above $75,000 and for joint filers with AGIs over $150,000.

Bar down-payment assistance for FHA loans. The bill eliminates a program that has allowed sellers to provide down payment assistance. The seller-funded program is largely the reason why the agency's reserve has fallen by $4.6 billion, according to FHA Commissioner Brian Montgomery. Currently, that reserve is roughly $16.4 billion.

The bill would also increase to 3.5% from 3% the down payment requirement for borrowers getting FHA loans.

Create an affordable housing trust fund. In the first three years of the FHA refinancing program, fees paid by Fannie and Freddie - based on a percentage of their new mortgage activity - would help defray potential government losses from loans that end in default. The fees would later pay for a permanent fund to promote affordable housing. Critics question, among other things, how Fannie and Freddie will be able to pay the fees if they are as undercapitalized as many say.

"It's not only bad policy, it's irresponsible," said House Financial Services Committee Ranking Member Spencer Bachus, R-Ala., during the House floor debate Wednesday. He noted that a year ago the GSEs had $106 billion in market capitalization and today they have roughly $20 billion.

Give grants to states to buy foreclosed properties. The bill would grant $4 billion to states to buy up and rehabilitate foreclosed properties. The funding had been opposed by the White House, which said it would benefit lenders and not homeowners. But given the administration's push to get a Fannie and Freddie rescue proposal in place quickly, Democratic leaders decided to keep the provision in the bill, sensing the president wouldn't kill the bill over it given its other priorities.

- CNN congressional producers Ted Barrett and Lesa Jansen contributed to this report.