Democratic leaders and a handful of Republicans announced an agreement late Wednesday to build President Trump’s border wall in exchange for granting citizenship rights to 1.8 million illegal immigrant Dreamers — setting up a showdown with a White House that has panned that kind of bargain as “weak.”

The proposal already has eight Republicans signed on, putting it within striking distance of the 11 needed to clear the Senate, if all Democrats were also to vote for it.

“This is one of the hardest issues Congress has had to grapple with in recent years,” said Senate Minority Leader Charles E. Schumer, New York Democrat and a co-sponsor of the plan. “Each side has had to give a great deal, but we are closer than we have ever been to passing something in the Senate to help the Dreamers.”

The plan does little to constrain chain migration, nor does it tackle the Diversity Visa Lottery — conditions that Mr. Trump has set for any bill he will sign.

The bill appears to create a future amnesty for the next four months by rewriting deportation priorities to say only illegal immigrants who arrive after June 30, 2018, are priorities for deportation going forward. Analysts said that could spur a four-month rush of illegal immigrants trying to sneak into the U.S.

Votes will come as early as Thursday, along with potential votes on a sanctuary city crackdown and on a broader immigration enforcement plan backed by the White House.

The dealmaking came after Democrats spent the first three days of immigration week blocking all floor action and retreating behind closed doors to try to work out another “grand bargain,” similar to the deals the Senate tried on immigration in 2007 and 2013.

Republican leaders expressed frustration, saying it was Democrats who had begged for a freewheeling debate — including shutting down the government in January over the issue — yet have refused to engage on the chamber floor.

“This is what they have been pleading for,” said Sen. Charles E. Grassley, Iowa Republican and chairman of the Senate Judiciary Committee.

Mr. Grassley is leading the chief Republican alternative that would include an amnesty for illegal immigrants, eliminate the diversity lottery and build the border wall — but would also limit chain migration and make changes to the law that would speed up deportations and punish repeat illegal immigrants.

That won the backing of Mr. Trump.

“The Grassley bill accomplishes the four pillars of the White House Framework: a lasting solution on DACA, ending chain migration, cancelling the visa lottery, and securing the border through building the wall and closing legal loopholes,” the president said in a statement.

He also said he would reject any “Band-Aid” bills that tried to do a smaller amnesty in exchange for border funding. That appeared to rule out the latest plan from Democrats and the rebel Republicans, which is a watered-down version of a plan Mr. Trump had declared “weak” last month.

Even with Mr. Schumer’s optimism, Democratic unity wasn’t assured. Some in the party — particularly those eyeing a 2020 challenge to Mr. Trump — have said they cannot support the border wall.

Sen. Cory A. Booker, New Jersey Democrat, emerged from a party caucus to say he wouldn’t guarantee that Democrats would be ready for votes Thursday.

“I think there is some really good momentum. I have a lot of hope and optimism that we are going to be able to get something done,” he told The Washington Times.

Whatever bill the Senate passes must then be approved by the more conservative House, where Republican leaders have said they won’t even hold a vote on something Mr. Trump won’t sign.

Instead, House Republicans were “whipping” — or rallying support within their troops — for a proposal led by House Judiciary Committee Chairman Bob Goodlatte, Virginia Republican.

That plan would enshrine the Obama-era Deferred Action for Childhood Arrivals program into law, giving Dreamers a chance to live and work legally but without a pathway to citizenship, in exchange for a crackdown on sanctuary cities, requiring businesses to use E-Verify to check their workers, and a whole series of other get-tough measures.

The bill also limits chain migration and ends the visa lottery.

Conservatives had complained that the House was in danger of being sidelined by letting the Senate take the lead — and one influential Republican lawmaker said House Speaker Paul D. Ryan could lose his post if he bungles the debate.

But Republican leaders had been wary of moving ahead on their own, particularly with a large number of centrist Republicans looking to deal with Democrats.

Rep. Mark Meadows, the North Carolina Republican who leads the Freedom Caucus, said the future of Mr. Ryan’s speakership could rest on how he handles the issue.

“I can say it is the defining moment for this speaker. If he gets it wrong, it will have consequences for him, but it will also have consequences for the rest of the Republican Party,” Mr. Meadows said Wednesday.

Mr. Ryan repeated his vow to resist any bill that Mr. Trump won’t sign.

“We want to find a solution. Our hope: that our Democratic colleagues are more interested in finding a solution than preserving an issue for campaigns,” Mr. Ryan said.

• Dave Boyer and Alex Swoyer contributed to this article.

Sign up for Daily Newsletters Manage Newsletters

Copyright © 2020 The Washington Times, LLC. Click here for reprint permission.