Weeks of intense negotiations for a bipartisan deal on immigration collapsed in Congress on Thursday, leaving hundreds of thousands of young undocumented immigrants facing possible deportation.

The rejection of four proposals in the Senate, coupled with a lack of consensus in the House, underscored the immense political pressures on Republicans and Democrats alike.

Immigration has proved in­trac­table for years, vexing lawmakers and presidents of both parties. Breaking the stalemate in an election year seemed even more unlikely.

In a sharp rebuke, the Republican-led Senate blocked an immigration plan backed by President Trump, with the bill mustering just 39 votes. It highlighted the divisions even within GOP ranks, with some wary that granting legal status to undocumented immigrants would amount to amnesty.

The House offered no answers, with conservatives threatening Speaker Paul D. Ryan (R-Wis.) unless he pushes a bill that provides only temporary work permits for dreamers, while also imposing ­border-security measures and restrictions on legal immigration that go beyond what Trump has proposed.

“I don’t think the president helped very much, but the bottom line is the demagogues won again on the left and the right,” said Sen. Lindsey O. Graham (R-S.C.).

How the Trump administration and Congress will resolve the fate of dreamers — undocumented immigrants who were brought into the country as children — remained unclear Thursday, but several senators said they hoped a solution could be included in a sweeping spending plan that must be passed by March 23.

Proposals have been floated by senators in both parties to temporarily extend the Deferred Action for Childhood Arrivals (DACA) program — which is set to end on March 5 — and provide some ­funding to begin border-security construction projects. Courts in California and New York have issued temporary injunctions requiring the administration to extend DACA; those rulings could render Trump’s deadline moot.

In the Senate on Thursday, the atmosphere was corrosive.

Senate Minority Leader Charles E. Schumer (D-N.Y.) blamed Trump, who had tweeted moments before the votes that the bipartisan plan was a “total catastrophe” that faced the threat of a veto.

“If he would stop torpedoing bipartisan efforts, a good bill would pass,” Schumer said.

In a tweet on Feb. 15, 2018, President Trump called on lawmakers to focus on “merit based immigration.” (Jabin Botsford/The Washington Post)

Sen. Tom Cotton (R-Ark.), a strong proponent of the president’s plan, said there was “broad agreement about how to solve this problem, but we won’t succeed unless the Democrats stop this incessant virtue-signaling and start negotiating in good faith.”

A senior White House official said Senate Majority Leader Mitch McConnell (R-Ky.) wants to move on from immigration, and the White House is inclined to agree. The individual, who spoke on the condition of anonymity to discuss the conversations, said McConnell has told White House officials that there is little appetite in his conference for continuing an immigration fight.

McConnell has told others that any bill he could pass in the Senate would be unlikely to earn Trump’s support.

The week began with the hope of a freewheeling debate on immigration policy, but robust exchanges never materialized. Instead — as is the modern-day custom — most of the action played out behind closed doors as a self-described “Common Sense Coalition” put the finishing touches on its plans and top party leaders discussed which amendments might earn votes.

Over the course of 90 minutes Thursday, the debate ended with no breakthrough.

Senators rejected a watered-down bipartisan plan by Sens. John McCain (R-Ariz.) and Christopher A. Coons (D-Del.) to grant legal status to dreamers and provide billions of dollars to boost border security — but not immediately as Trump requested. The plan failed 52 to 47, short of the 60 votes needed.

Senators also rejected a bill by Sen. Patrick J. Toomey (R-Pa.) to punish “sanctuary” municipalities that refuse to help enforce immigration laws. That bill failed 54 to 45.

Much of the Senate’s attention was on the third option, a bipartisan plan to legalize the same ­number of undocumented immigrants and appropriate $25 billion for southern-border-security construction projects over the next decade — not immediately as Trump wants. That bill also would curb family-based immigration programs but not to the extent Trump is seeking, and it said nothing about the diversity visa lottery program.

The bipartisan proposal laid bare how difficult it can be for members of both parties to try striking a deal. United We Dream — a dreamer advocacy group that works closely with Democrats — and the White House had aggressively lobbied against the measure.

The frustration of bipartisan negotiators was evident. Before the vote, Sen. Susan Collins (R-Maine), who had helped broker the deal, was heard in the well of the chamber chastising Laura Dove, the top Republican parliamentary expert, over the names of senators listed as being involved in the legislation.

The Democratic leader had not been part of writing the bill, but his name was included in official notices because of the complex rules regarding how amendments are considered.

As the two clashed, Collins brandished her cellphone to show Dove the messages proving that copies of the legislation did not include Schumer’s name.

“You’re supposed to be a fair broker,” Collins said as she walked away from Dove. “It was wrong. It was really wrong.”

The bipartisan plan failed 54 to 45.

Finally, senators rejected the Trump plan, which would have granted legal status to 1.8 million young immigrants, spent at least $25 billion to bolster security along the U.S.-Mexico border, revamped family-based legal migration programs and ended a diversity lottery system used by immigrants from countries with low rates of immigration to the United States.

The vote was 39 to 60, well short of the 60 yes votes needed to move ahead. Three moderate Democrats voted for the proposal, but 14 GOP senators voted against it, including Sen. Ted Cruz (Tex.), who had blasted the proposal as being “to the left from President Obama’s position.”

Ahead of the votes, the White House mobilized a full-fledged effort to scuttle the bipartisan immigration plan that was emerging as the best hope for a legislative deal.

Administration officials said they strenuously lobbied individual Republican senators, as well as House leadership, to oppose the bill. The Department of Homeland Security also issued a lengthy “fact-sheet” that said the plan “destroys the ability” of the agency to enforce immigration laws and represents an “egregious violation” of the immigration framework Trump sent to Capitol Hill.

Responding to DHS’s statement at a news conference, Graham said he thought, “ ‘Who the hell wrote this?’ Because it sounded like something that came from a political hack, not DHS.”

On a conference call, a White House official, speaking on the condition of anonymity to discuss strategy, lambasted Graham, noting that he was at the center of past immigration debates that ultimately fizzled and suggesting that he has been “part of the problem.”

On Capitol Hill, attention is likely to shift to the House, which could take up the issue after next week’s Presidents’ Day recess.

A bill sponsored by Judiciary Committee Chairman Bob Goodlatte (R-Va.) and Homeland Security Committee Chairman Michael McCaul (R-Tex.) has the backing of the hard-right House Freedom Caucus and other conservatives who want to stake out a position further to the right of the White House proposal to guard against future concessions.

The bill includes new resources for immigration enforcement away from the border; a crackdown on “sanctuary cities” — ­jurisdictions that do not cooperate with federal immigration enforcement authorities; and a requirement that employers use ­“E-Verify,” a federal database, to check whether their employees are authorized to work in the United States.

“We have the bill that’s consistent with what the American people elected us to do,” said Rep. Jim Jordan (R-Ohio), a co-founder of the Freedom Caucus.

But it is not at all clear that the bill, which has no Democratic support, can win enough Republican votes to pass the House.

Ed O'KeefeEd O’Keefe covered Congress and national politics for The Washington Post from 2008 to 2018. He has also covered federal agencies and federal employees in the Washington area, the war in Iraq, and the 2016 presidential campaigns of Jeb Bush and Marco Rubio. Follow

David NakamuraDavid Nakamura covers the White House. He has previously covered sports, education and city government and reported from Afghanistan, Pakistan and Japan. Follow

Mike DeBonisMike DeBonis covers Congress, with a focus on the House, for The Washington Post. He previously covered D.C. politics and government from 2007 to 2015. Follow