WASHINGTON -- The Senate Judiciary Committee approved the bipartisan "gang of eight" immigration bill on Tuesday in a 13 to 5 vote after a marathon final day of markup that stretched into the evening.

All Democrats on the committee, along with Sen. Orrin Hatch (R-Utah) and gang of eight Republican Sens. Lindsey Graham (R-S.C.) and Jeff Flake (R-Ariz.), voted in favor of the bill, which will now go to the Senate floor. Sen. John Cornyn (R-Texas), who voted against the bill out of committee, said he would support allowing it to move forward for debate -- rather than joining a filibuster -- once on the Senate floor. Sen. Chuck Grassley (R-Iowa), who was also a "no" vote, said if it had been between his vote and moving the bill to the Senate floor, he would have voted in favor.

The crowd in the room erupted into applause when the final vote tally was read, rising to their feet and chanting "Yes we can!" then "Si se puede!"

Democrats seemed equally pleased to vote the bill out of committee.

"The dysfunction in our current immigration system affects all of us and it is long past time for reform," Judiciary Chairman Patrick Leahy (D-Vt.) said before the bill's passage. "I hope that our history, our values, and our decency can inspire us finally to take action. We need an immigration system that lives up to American values and helps write the next great chapter in American history by reinvigorating our economy and enriching our communities."

Of 300 amendments offered to the gang of eight immigration bill, the committee debated more than 200.

The bill came out of months of work from the gang of eight, which in addition to Graham and Flake includes Sens. John McCain (R-Ariz.), Marco Rubio (R-Fla.), Chuck Schumer (D-N.Y.), Dick Durbin (D-Ill.), Michael Bennet (D-Colo.) and Bob Menendez (D-N.J.). It includes a path to citizenship for undocumented immigrants, a streamlined legal immigration process, tougher interior enforcement and increased border security.

One of the final issues to settle was over high-skilled worker visas called H1-Bs. An amendment that simplifies the process for companies to bring in workers in science, technology, engineering and math eventually passed on a voice vote. Hatch and Schumer came to a compromise that led Hatch to agree to vote the full bill out of committee, although he did not commit to supporting its eventual passage.

It was a tough vote for Sen. Dick Durbin (D-Ill.), who has previously been wary of expanding H1-B visas. He voted in favor, however, citing the need for compromise and to get the bill through.

"We've made concessions I never thought we'd have to make ... but we've made those concessions to win your support," Durbin said to Hatch. "We need your support, and we want to pass this bill."

The amendment came under fire from the AFL-CIO labor federation, which said the measure would hurt American workers.

"There is no reason why this strong coalition should accept anti-worker amendments," AFL-CIO President Richard Trumka said in a statement. "And let's be clear: Senator Orrin Hatch's H-1B amendments are unambiguous attacks on American workers."

Some measures praised highly by immigrant rights advocates never went to a vote. Leahy brought up his amendment to allow LGBT couples equal protection under immigration law, but withdrew it "with a heavy heart" when it became clear Democrats were willing to drop it so the bill would pass.

A number of provisions lauded by advocates did make it in. The committee voted on Monday to approve Blumenthal's amendment that would block immigration raids in sensitive areas such as schools, hospitals and places of worship, except in extreme circumstances. A separate Blumenthal measure to restrict the use of solitary confinement in immigrant detention also passed on Monday, also on a voice vote.

Although many Republican amendments failed, some GOP senators, such as Hatch, were more successful than others. The committee voted on Monday to require a mandatory biometric exit system at airports with the highest volume of international air travel -- something Sen. Jeff Sessions (R-Ala.) wanted to do nationwide but without success.

Amendments deemed poison pills failed, unsurprisingly. Sen. Ted Cruz (R-Texas) attempted to add a change that would strip the bill of its path to citizenship for undocumented immigrants, which is considered absolutely necessary to the bill by President Barack Obama, Democrats and some Republicans. Five Republicans voted for that amendment, while three -- Hatch, Graham and Flake -- joined Democrats in opposing it.

Leahy said the amendment would gut the bill, while Sen. Chuck Schumer (D-N.Y.) said "it goes against everything America stands for." Sen. Dick Durbin (D-Ill.) similarly disparaged another failed Cruz amendment, this one to bar currently undocumented immigrants from ever being eligible for welfare benefits such as Medicaid and food stamps, saying he doesn't think such an America is one he'd want to live in.

Sessions was also unsuccessful in his efforts to amend the bill, offering 49 amendments and seeing nearly every one that went for a vote fail. On one amendment last week Sessions was the sole "yes" vote, with all of his Republican colleagues abandoning him in his effort to limit legal immigration.

Sen. Mazie Hirono (D-Hawaii) was one of the rare Democrats to offer an amendment that the gang of eight took down. Schumer and Durbin told her they had to reluctantly oppose her attempt on Tuesday to add a change that would expand family visas so that people in extreme hardship could petition for green cards for their adult children or siblings. It failed with 7 votes in support and 11 against, including Democrats Schumer, Durbin, and Sen. Dianne Feinstein (D-Calif.), all of whom said it was a good amendment but would upset the delicate balance of the gang of eight bill.

"Your heart's in the right place, your amendment's in the wrong place," Durbin said to Hirono.

President Barack Obama applauded the committee for passing the bill.

"None of the Committee members got everything they wanted, and neither did I, but in the end, we all owe it to the American people to get the best possible result over the finish line," he said in a statement. "I encourage the full Senate to bring this bipartisan bill to the floor at the earliest possible opportunity and remain hopeful that the amendment process will lead to further improvements."

Now that the bill passed the Senate Judiciary Committee, it has to go to the Senate floor, where gang of eight members are hopeful it will pass. Schumer and McCain, who is not on the Judiciary Committee, have said they would like to win over a majority of both parties -- around 70 votes in total.

Also on HuffPost:

Loading Slideshow...
  • The Template: California Proposition 187 (1994)

    California's Proposition 187 was submitted to the voters with the full support of then Republican governor Pete Wilson. It essentially blamed undocumented immigrants for the poor performance of the state economy in the early 1990s. The law called for cutting off benefits to undocumented immigrants: prohibiting their access to health care, public education, and other social services in California. It also required state authorities to report anyone who they suspected was undocumented. <strong>Status:</strong> The law passed with the support of 55 percent of the voters in 1994 but declared unconstitutional 1997. The law was killed in 1999 when a new governor, Democrat Gray Davis, refused to appeal a judicial decision that struck down most of the law. Even though short-lived, the legislation paved the way for harsher immigration laws to come. On the other hand, the strong reaction from the Hispanic community and immigration advocates propelled a drive for naturalization of legal residents and created as many as one million new voters.

  • The Worst: Arizona SB 1070

    The Arizona Act made it a misdemeanor for an undocumented immigrant to be within the state lines of Arizona without legal documents allowing their presence in the U.S. This law has been widely criticized as xenophobic and for encouraging racial profiling. It requires state authorities to inquire about an individual's immigration status during an arrest when there is "reasonable suspicion" that the individual is undocumented. The law would allow police to detain anyone who they believe was in the country illegally. <strong>Status:</strong> The law was signed into law by Arizona Governor Jan Brewer on April 23, 2010. But it has generated a swirl of controversy and questions about its constitutionality. A federal judge issued a ruling that blocked what critics saw as some of the law's harshest provisions. House: 35-31 (4/12/2011)

  • Following Arizona's Footsteps: Georgia HB 87

    The controversy over Arizona's immigration law was followed by heated debate over Georgia's own law. HB 87 required government agencies and private companies to check the immigration status of applicants. This law also limited some government benefits to people who could prove their legal status. <strong>Status:</strong> Although a federal judge temporarily blocked parts of the law considered too extreme, it went into effect on July 1st. 2011. House: 113-56 Senate: 39-17

  • Verifying Authorized Workers: Pennsylvania HB 1502

    This bill, which was approved in 2010, bans contractors and subcontractors employ undocumented workers from having state construction contracts. The bill also protects employees who report construction sites that hire illegal workers. To ensure that contractors hire legal workers, the law requires employers to use the identification verification system E-verify, based on a compilation of legally issued Social Security numbers. <strong>Status:</strong> Approved on June 8th 2010. House: 188-6 (07/08/2010) <a href="http://www.flickr.com/photos/donkeyhotey/" target="_hplink">Flickr photo by DonkeyHotey</a>

  • A Spin Off of Arizona: Utah HB 497

    Many states tried to emulate Arizona's SB 1070 law. However, most state legislatures voted against the proposals. Utah's legislature managed to approve an immigration law based on a different argument. Taking into consideration the criticism of racial profiling in Arizona, Utah required ID cards for "guest workers" and their families. In order to get such a card workers must pay a fee and have clean records. The fees go up to $2,500 for immigrants who entered the country illegally and $1,000 for immigrants who entered the country legally but were not complying with federal immigration law, <a href="http://articles.latimes.com/2011/mar/06/nation/la-na-illegal-immigration-20110306" target="_hplink">according to the LA Times.</a> <strong>Status: </strong> Law went into effect on 03/15/2011 House: 59-15 (03/04/2011) Senate: 22-5 (03/04/2011)

  • The Most Comprehensive: Florida HB-1C

    Florida's immigration law prohibits any restrictions on the enforcement of federal immigration law. It makes it unlawful for undocumented immigrants within the state to apply for work or work as an independent contractor. It forbids employers from hiring immigrants if they are aware of their illegal status and requires work applicants to go through the E-verify system in order to check their Social Security number. <strong>Status: </strong>effective since October 1st, 2010

  • The Hot Seat: Alabama HB 56

    The new immigration law in Alabama is considered the toughest in the land, even harder than Arizona's SB 1070. It prohibits law enforcement officers from releasing an arrested person before his or her immigration status is determined. It does not allow undocumented immigrants to receive any state benefit, and prohibits them from enrolling in public colleges, applying for work or soliciting work in a public space. The law also prohibits landlords from renting property to undocumented immigrants, and employers from hiring them. It requires residents to prove they are citizens before they become eligible to vote. The law asked every school in the state to submit an annual report with the number of presumed undocumented students, but this part, along with others, were suspended by federal courts. <strong>Status:</strong> Approved June 2nd, 2011 House: 73-28 (04/05/2011) Senate: 23-11 (05/05/2011) <a href="http://www.flickr.com/photos/longislandwins/" target="_hplink">Flickr photo by longislandwins</a>