WASHINGTON (AP) -- A far-reaching bill to remake the nation's immigration system is headed to the full Senate, where tough battles are brewing on gay marriage, border security and other contentious issues, with the outcome impossible to predict.
The Senate Judiciary Committee approved the measure 13-5 Tuesday night, setting up an epic showdown on the Senate floor after Congress' Memorial Day recess. The legislation is one of President Barack Obama's top domestic priorities - yet it also gives the Republican Party a chance to recast itself as more appealing to minorities.
Many involved still vividly recall the last time the Senate took up a major immigration bill, in 2007, beginning with high hopes only to see their efforts collapse on the Senate floor amid a public backlash and interest group defections.
Some expressed optimism for a better outcome this time around as the Judiciary Committee gave its bipartisan approval. Three Republicans - Sens. Lindsey Graham of South Carolina and Jeff Flake of Arizona, both authors of the bill, and Sen. Orrin Hatch of Utah - joined the 10 committee Democrats in supporting the measure.
"We've demonstrated to the United States Senate we can all work together, Republicans and Democrats," said the panel's chairman, Sen. Patrick Leahy, D-Vt. "Now let's go out of this room and work together with the other members of the Senate, and with the other body (the House), and more importantly work with all Americans, and all those who wish to be Americans."
In a statement, Obama applauded the committee's action and said the bill was "largely consistent with the principles of common-sense reform I have proposed and meets the challenge of fixing our broken immigration system."
The legislation would create new routes for people to come legally to the U.S. to work at all skill levels, tighten border security and workplace enforcement, and offer a chance at citizenship to the 11 million people here illegally.
Senate Majority Leader Harry Reid, D-Nev., has said he would bring the legislation to the Senate floor early next month for a debate that some aides predicted could consume a month or more. The fate of immigration legislation in the House was even less clear, although it was due to receive a hearing in the House Judiciary Committee on Wednesday.
It was Leahy's 11th-hour decision to hold back on an amendment to extend immigration rights to same-sex married couples that cleared the way for the bill's approval.
Until Leahy began speaking on the issue to a hushed hearing room Tuesday evening, it wasn't clear how the matter, which had hovered over the three weeks of committee sessions to review the legislation, would play out.
Leahy had been under pressure from gay groups to offer the amendment, which would allow gay married Americans to sponsor their foreign-born spouses for green cards like straight married Americans can. But Republican supporters of the bill warned that including such a measure would cost their support. As the committee neared the end of its work, officials said Leahy had been informed that both the White House and Senate Democrats hoped he would not risk the destruction of months of painstaking work by putting the issue to a vote.
"I don't want to be the senator who asks people to choose between the love of their life and the love of their country," Leahy said, adding that he wanted to hear from others on the committee.
In response, he heard a chorus of pleas from the bill's supporters not to force a vote that they warned would lead to the collapse of Republican support and the bill's demise.
"I don't want to blow this bill apart," said Sen. Dianne Feinstein, D-Calif., the first to speak up.
"I believe in my heart of hearts that what you're doing is the right and just thing," said Sen. Richard Durbin, D-Ill. "But I believe this is the wrong moment, that this is the wrong bill."
Sens. Chuck Schumer, D-N.Y., and Al Franken, D-Minn., added their voices, and Leahy announced that, "with a heavy heart," he would withdraw his amendment.
Gay rights groups voiced outrage, and the issue is certain to re-emerge when the full Senate debates the legislation. But it is doubtful that sponsors can command the 60 votes that will be needed to make it part of the legislation.
In the hours leading to a final vote, the panel also agreed to a last-minute compromise covering an increase in the visa program for high-tech workers, a deal that brought Hatch over to the ranks of supporters.
Under the bill, the number of highly skilled workers admitted to the country would increase greatly, but there were also protections aimed at ensuring U.S. workers get the first shot at jobs, and high-tech companies objected to some of those.
Under the deal, companies in which foreign labor accounts for at least 15 percent of the skilled workforce would be subjected to tighter conditions than businesses less dependent on H-1B visa holders, and requirements on recruiting and hiring and firing of U.S. workers would be relaxed.
In defeat, opponents said they, too, wanted to overhaul immigration law, but not the way that drafters of the legislation had done.
Sen. Charles Grassley, R-Iowa, recalled that he had voted to give "amnesty" to those in the country illegally in 1986, the last time Congress passed major immigration legislation. He said that bill, like the current one, promised to crack down on illegal immigration, but said it had failed to do so.
"No one disputes that this bill is legalization first, enforcement later. And that's just unacceptable to me and to the American people," he said.
AP White House Correspondent Julie Pace contributed to this report.