The House last night passed tough immigration legislation to build vast border fences, force employers to verify the legality of their workers and tighten security on the nation's frontier, but it rebuffed President Bush's entreaties to include avenues for foreign workers to gain legal employment.

The bill was designed to demonstrate to voters a new resolve on border security before the House adjourns for the year. But it also revealed deep divisions in the Republican Party between lawmakers who agree with Bush that a strict clampdown alone cannot work without a guest-worker program for noncitizens, and others resolutely opposed to any plan that would keep undocumented workers flowing into the country.

Bush had made the immigration issue a top item on his domestic agenda, hoping a carrot-and-stick approach to dealing with a growing number of illegal immigrants and undocumented workers would satisfy conservatives while advancing his efforts to reach out to Latino voters. But in the face of unyielding conservative opposition in the House, leaders abandoned the president's guest-worker plan, which would have allowed foreign workers into the country under temporary work visas.

The House bill was adamantly opposed by an unusual coalition of business lobbies; ethnic groups, such as the National Council of La Raza; religious organizations; and labor unions that contend the measure is too harsh on illegal immigrants and imposes unworkable requirements on employers. Supporters -- including the House Republican leadership -- are convinced their measure has the ardent support of constituents fed up with illegal aliens flooding through the border. The Senate will probably consider a very different version next year that includes a guest-worker provision.

"For the first time, I can go out on the stump and say our party has done right on the issue of immigration," said Rep. Tom Tancredo (R-Colo.), a firebrand on illegal immigration who drove the debate. "And I feel good about it."

Opponents from both parties said the House had approved a punitive measure that could criminalize not only undocumented workers but also their families and employers, while doing nothing to bring some 11 million illegal aliens out of the shadows and into lawful society.

"We owe a little more honesty to our constituents," said Rep. Jeff Flake (R-Ariz.), whose efforts to pass nonbinding language endorsing a guest-worker program were rebuffed by GOP leaders. The bill "means those who are here illegally will stay in the shadows," he said. "That's unacceptable. That's not enforcement. That's a charade."

The future of the immigration bill is unclear. In the Senate, bipartisan support is growing for legislation co-authored by Sens. John McCain (R-Ariz.) and Edward M. Kennedy (D-Mass.) that would combine border enforcement measures with a guest-worker program. But a large number of House conservatives say they will never accept such a measure.

"I really worry that anything we do over here will be a vehicle for a guest-worker program," said Rep. J.D. Hayworth (R-Ariz.).

Tancredo agreed: "Now the fight begins."

Under the House bill, employers would have to confirm the authenticity of employees' Social Security numbers against a national database of legitimate numbers or face stiff new fines of as much as $25,000 per violation. The measure would end the "catch and release" policy for immigrants other than Mexicans who are caught entering the country illegally and then released with a court date. All illegal immigrants apprehended at the border would have to be detained, and deportation processes would be streamlined.

Criminal penalties for smuggling immigrants would be stiffened, with new mandatory minimum sentences. Immigrant gang members would be rendered inadmissible under any circumstance. Mandatory minimum sentences would be established for immigrants who reenter illegally after deportation, and local sheriffs in the 29 counties along the Mexican border would be reimbursed for detaining illegal immigrants and turning them over to federal custody.

Under an amendment approved Thursday night, the nation would spend more than $2.2 billion to build five double-layer border fences in California and Arizona, totaling 698 miles at $3.2 million a mile. Another amendment approved last night would empower local law enforcement nationwide to enforce federal immigration law and be reimbursed for their efforts.

For House leaders, the bill presented a delicate balancing act to satisfy members clamoring for a real crackdown while not alienating Latino voters whom Bush and his handpicked Republican Party chairman, Ken Mehlman, have courted. GOP leaders refused to give Rep. Jim Kolbe (R-Ariz.) a vote on his proposed guest-worker program, after lawmakers strongly opposed to illegal immigration threatened to scuttle the entire bill if the Kolbe amendment was brought to the floor.

But leaders also rejected proposed amendments to eliminate automatic citizenship for babies born to illegal aliens on U.S. soil and to build a fence along the entire southern border.

All of Maryland's representatives except Wayne T. Gilchrest (R) opposed the bill. The Virginia delegation voted for it, except Democrats James P. Moran Jr. and Robert C. "Bobby" Scott, who voted against, and Republican Jo Ann S. Davis, who did not vote.

The passage of the bill was a bright spot for congressional leaders in an otherwise difficult year-end crunch that has been marked by defeat and disarray. House and Senate leaders are forcing lawmakers to stay on Capitol Hill through the weekend as they struggle to complete funding measures.

Last night, budget negotiators achieved a breakthrough when Sen. Ted Stevens (R-Alaska) agreed to drop from the budget-cutting measure a provision to open Alaska's Arctic National Wildlife Refuge to oil drilling. Instead, Stevens will take his chances that he can pass the provision in the defense spending bill.

Stevens's decision may clear the way for a deal today to shave federal spending by a little more than $40 billion over five years.