The Senate on Thursday defeated a bipartisan bill that many Democrats thought was their best shot at finding an immigration agreement, in a vote that will likely force the Senate to go back to the drawing board on an issue that President Trump has said needs a solution by March 5.

The Senate called up an immigration proposal from Sen. Susan Collins, R-Maine, Mike Rounds, R-S.D., and Angus King, I-Maine, that would have enabled citizenship for 1.8 million young people who were brought to the United States illegally as children. The legislation would provided $25 billion in border security funding and would prohibit Dreamers from sponsoring citizenship for their parents.

The proposal would have codified Homeland Security enforcement priorities to serious criminals and those who arrived in the country illegally after January 1.

But it does not include language to end chain migration and the diversity visa lottery, two goals that are important to Trump and most Republicans. And as expected, it failed to win the 60 votes needed to end debate on the language due to stiff Republican opposition — it fell in a 54-45 vote.

Kamala Harris of California, Martin Heinrich of New Mexico and Tom Udall of New Mexico were the only Democrats to vote against the bill.

This week, Senate Minority Leader Chuck Schumer, D-N.Y., said the bill was the "best chance" at reaching a deal, even though it excluded two major GOP priorities.

The legislation was denounced by the Trump administration as a "mass amnesty" proposal and President Trump threatened to veto it. But it won the support of eight Republicans, and Rounds argued that it could serve as a step toward some final agreement.

“We are bringing attention to the fact that you really can work across the aisle,” Rounds said. “And you really can build a coalition of people that will accept border security and $25 billion dollars, and that we can do something for these kids while still laying groundwork so that the parents do not get a leg up on anybody else.”

The failed vote followed two other bills that failed to reach 60 votes. First, the Senate defeated a bill from Sens. John McCain, R-Ariz., and Chris Coons, D-Del., that tried to pair legal protection for Dreamers and about $3 billion in border security funding, far short of what Trump has demanded.

Most Republicans and President Trump are looking for $25 billion in border wall funding, plus language on chain migration and the visa lottery to tamp down on immigration levels.

The McCain-Coons bill couldn't make the 60-vote threshold, and fell 52-47.

A second bill, written by Sen. Pat Toomey, R-Pa., would have withheld certain federal funding from sanctuary cities that fail to cooperate with immigration officials, a proposal Democrats strongly oppose.

Toomey's bill failed 54-45.

A final bill from Sen. Chuck Grassley, R-Iowa, also failed due to a lack of support from Democrats and several Republicans. His bill followed the framework put forward by the Trump administration, but it failed 39-60, making it the least popular option in the Senate.

Specifically, Grassley's measure provides the same citizenship pathway and border security funding as the Collins-Rounds proposal, but it also limits chain migration to spouses and minor children. It would also end the visa lottery system and reallocate the annual 50,000 spaces to clearing the non-lottery visa backlog.

Grassley said just before the final vote that his bill was the only one that had a shot at becoming law.

"This is the only plan that can become law because the president said he would sign it," Grassley said. "This is the last chance to offer citizenship to all the people we have been talking about… here we are, an opportunity to do it."

But Schumer blamed Trump for opposing the Rounds plan. "President Trump has failed his test of leadership spectacularly," Schumer said.

It's not clear whether or when Senate Majority Leader Mitch McConnell, R-Ky., will bring immigration reform back to the Senate floor. He said it would initially be limited to this week.