Updated

A proposed immigration overhaul survived a stiff challenge Wednesday as the Senate turned back a Democrat's bid to emphasize reuniting families more than job skills for many foreigners seeking to move to the U.S.

Supporters of bipartisan compromise for legalizing 12 million unlawful immigrants invoked rules effectively requiring an amendment to win 60 votes to keep their delicate coalition from crumbling.

Sen. Robert Menendez, D-N.J., got 53 votes for his effort to delay shifting U.S. immigration policy away from keeping families together in favor of attracting more foreign workers. But that was seven votes short of the 60 needed. Voting against him were 44 senators.

The Menendez amendment would have allowed more than 800,000 people who had applied for permanent legal status by the beginning of 2007 to obtain green cards based purely on their family connections — a preference the bill ends for most relatives who got in line after May 2005.

Menendez, whose parents were Cuban immigrants, told his colleagues that the bill will undermine "the reunification of families."

Meanwhile, critics of the bill's main feature — legalizing the estimated 12 million immigrants in the U.S. unlawfully — won an amendment that could make it easier to locate and deport illegal immigrants whose visa applications are rejected.

The bill would have barred law enforcement agencies from seeing applications for so-called Z visas, which can lead to citizenship if granted. Sen. John Cornyn, R-Texas, called for lifting the ban, saying legal authorities should know if applicants have criminal records that would warrant deportation.

His measure was adopted, 57-39, although opponents said eligible applicants might be afraid to file applications if they believe they are connected to deportation actions.

Cornyn earlier lost a vote to bar from legalization people under court orders to be deported.

The vote was 51-46 against the amendment. Democrats succeeded in pulling support from Cornyn's proposal by winning adoption of a rival version that would bar a more limited set of criminals, including certain gang members and sex offenders, from gaining legalization. The Senate backed that amendment 66-32.

Cornyn had painted his effort as a "defining issue" for any presidential candidate — a sign of the degree to which the contentious debate is bleeding over into the GOP campaign fray.

Sen. John McCain, R-Ariz., alone among his party's presidential aspirants in backing the immigration measure, opposed Cornyn's bid and backed the Democratic alternative offered by Sen. Edward M. Kennedy, D-Mass.

McCain was joined in opposing the amendment by the Senate's four Democratic presidential hopefuls, Sens. Joseph Biden of Delaware, Hillary Rodham Clinton of New York, Christopher Dodd of Connecticut, and Barack Obama of Illinois.

After his defeat, Cornyn said those who voted against the proposal "failed to take an opportunity to help restore public confidence that we're actually serious about passing an immigration law that could actually work."

Many Americans will conclude instead that the bill's enforcement provisions will not be rigorously enforced, a problem that deeply undermined a 1986 immigration overhaul, he added.

Sen. Chuck Schumer, D-N.Y., called Cornyn's measure "a stealth, Trojan horse amendment to kill the bill."

In addition to legalizing millions of unlawful immigrants, the bill would tighten border security and institute new enforcement measures to prevent employers from hiring illegal workers.

Its proponents were laboring to push through the compromise under new time constraints imposed by Majority Leader Harry Reid, D-Nev., who plans to force a test vote as early as Thursday morning to end debate on it and move on to other matters.

Senators in both parties implored Reid not to yank the measure, as he has threatened to do if the test vote fails.

"I think it's safe to say that the United States Senate would be the laughingstock of the country if — after all of the hyperbole and all of the publicity and all of the proposals and objections — we're not able to finish this bill," said Sen. Arlen Specter, R-Pa., a framer.

Other amendments defeated Wednesday included a Democratic effort to alter the temporary guest worker program that would be created by the bill.

Sen. Jeff Bingaman of New Mexico wanted to allow workers to come for six consecutive years. The Senate voted 57-41 to reject the amendment, retaining the bill's call for most guest workers to go home for a year between each of three two-year stints.