After months of talks, Senate negotiators on Sunday released a sweeping bipartisan border security deal that is aimed at discouraging migrants from crossing the U.S.-Mexico border.

The $118 billion national security legislation also includes billions of dollars in funding for Ukraine, Israel, the Indo-Pacific and humanitarian aid, but it has a politically perilous path ahead. Even before seeing its contents, lawmakers on both the right — and, to a lesser extent, the left — flanks in Congress have slammed the measure and House Speaker Mike Johnson (R-La.) called it “dead on arrival” in the chamber. Former president Donald Trump, who has made the border a core campaign issue, opposes the deal.

Senate Majority Leader Charles E. Schumer (D-N.Y.) announced that he would hold the first procedural vote on the legislation on Wednesday, leaving the bill’s boosters little time to sell its provisions. “Senators must shut out the noise from those who want this agreement to fail for their own political agendas,” he said in a statement Sunday evening.

The legislation — a top priority for President Biden — would, if passed, mark the first significant action taken by Congress on immigration in decades. It attempts to close loopholes in the asylum process, limit the use of parole for migrants at the border and give the president new authority to effectively shut down the border to migrants when attempted crossings are high. “Get it to my desk so I can sign it into law immediately,” Biden said in a statement.

An administration official also said Sunday the bill would help Israel “replenish its air defenses” as it continues its offensive against Hamas in Gaza, as well as provide funds for U.S. Central Command as it defends positions in Iraq and Syria and continues to clash with Yemen’s Houthis in the Red Sea.

Sen. James Lankford (R-Okla.), the lead Republican negotiator, called the bill’s changes to asylum “dramatic,” and predicted it would discourage migrants from attempting to come to the United States if passed.

“People come in mass numbers because they’re getting released,” into the country, Lankford said in an interview Sunday. “If the word gets out immediately that it’s not true anymore, people will come in a more orderly fashion.”

The proposal would make it harder for migrants to apply for and qualify for asylum. The bill also encourages quicker resolutions to asylum cases at the border and creates a new removal authority to speedily remove migrants who don’t qualify for asylum.

The bill includes a trigger mechanism that would allow the border to be effectively shut down to migrants if crossings have been particularly high for several days in a row. (Around 1,400 migrants would still be able to qualify for asylum at ports of entry.)

That “border emergency” provision, which expires in three years, would automatically kick in when crossings reached 5,000 per day for several days, but a president could choose to use the tool at a lower number, 4,000 per day. The legislation also scales back the Biden administration’s use of parole at land ports of entry and provides for the hiring of thousands of new Border Patrol and asylum officers, as well as increasing detention capacity.

The proposal also includes some Democratic priorities, including adding thousands more family-based and employment-based visas, allowing work authorization for spouses of U.S. citizens awaiting immigrant visas and guaranteeing access to counsel for child migrants in removal proceedings. The legislation also allows for work visas for those who do qualify for asylum.

Republicans initially demanded a border policy change to pass $60 billion in Ukraine aid requested by the White House last year, and the final deal contains many tough border provisions that Republicans have long hoped to implement.

But the politics of the deal abruptly changed when Trump and his allies began attacking the idea of passing any border legislation — fearful that addressing the border crisis might remove a potent campaign issue for him in an election year. Many Senate Republicans have signaled that they will not support the package, and some have mischaracterized its contents as negotiators took months to finalize the bill text.

“It’s remarkable that we were able to change not just policy over the course of negotiations but the politics of the Democratic base that (they) accepted border security,” said one frustrated Republican senator who spoke on the condition of anonymity to speak freely about the likely Republican presidential nominee. “And here we are, Trump once again snatches defeat from the jaws of victory.”

Johnson said this weekend he planned a vote in the House on billions in aid to Israel without money for Ukraine or the border, further complicating the Senate deal’s prospects. “The House is willing to lead and the reason we have to take care of this Israel situation right now is because the situation has escalated,” he said on NBC’s “Meet the Press” before the release of the text.

In a letter to his Democratic colleagues, House Minority Leader Hakeem Jeffries (D-N.Y.) called Johnson’s new Israel-only bill “a cynical attempt to undermine the Senate’s bipartisan effort.”

Senate Minority Leader Mitch McConnell (R-Ky.) has been supportive of the deal, however, as he publicly fights for continued aid to Ukraine as it struggles to fend off a Russian invasion. Schumer has also firmly backed negotiations led by Lankford, Sen. Chris Murphy (D-Conn.), Sen. Kyrsten Sinema (I-Ariz.) and the White House, arguing that it is the Senate’s responsibility to ensure Russian President Vladimir Putin does not continue his assault on a European nation.

The United States has sent $44 billion in security assistance to Ukraine since the 2022 invasion, but the Biden administration warned late last year that it had reached the end of its ability to continue to arm Ukraine absent congressional help. Republican lawmakers began to object to sending more money to the nation last year as polls showed their voters souring on the idea.

“The challenges we face will not resolve themselves, nor will our adversaries wait for America to muster the resolve to meet them,” McConnell said in a statement. “The Senate must carefully consider the opportunity in front of us and prepare to act.”

Border officials in December processed the most migrants ever recorded in one month — around 300,000 — and Biden has said he wants congressional help to ease the crisis. A majority of voters disapprove of his handling of the border, polls show, making the issue a potential liability for him as he seeks reelection in 2024.

The overall aid package includes $14 billion in assistance for Israel, $60 billion for Ukraine and $4.83 billion to Indo-Pacific nations. It also has $9.2 billion in humanitarian aid for civilians in Gaza, the West Bank, Ukraine and other nations, as well as $20 billion in U.S. border funds. (The bill explicitly denies federal funding to UNRWA, the U.N. agency that aids Palestinians, following allegations that 12 of its 13,000 employees were involved in the Oct. 7 Hamas attack on Israel.) Its $118 billion overall price tag is now higher than the White House’s initial request of $106 billion.

The talks have been unusual, given that past efforts at bipartisan immigration reform included discussions of providing pathways to citizenship for undocumented immigrants already living in the country demanded by Democrats, in addition to tightening border restrictions.

Some immigrant rights groups expressed dismay at the border deal on Sunday. Kica Matos, president of the National Immigration Law Center, said the bill would lead to “more families separated, more children detained, and more people sent back to face persecution, torture, and even death.”

“Instead of enacting draconian policies that create more chaos, we urge the White House and Senate Democrats to change course, reject this framework, and recommit to building an orderly, humane, and functioning immigration system,” she said in a statement.

Sen. Alex Padilla (D-Calif.) said on Sunday he was opposed to the bill, comparing it to “failed Trump-era immigration policies.”

Republicans who support this deal are urging their colleagues to back it, arguing there is no way they would get border restrictions even if Trump is elected president, given that Democrats are unlikely to cooperate with him without demanding legalization for undocumented immigrants as part of the process.

“This is a unique moment,” Sinema said last month. “And I think we should take it.”

The politics of the issue rapidly changed after Trump signaled his displeasure with a deal and as he appears primed to lock up the Republican presidential nomination. A faction of Lankford’s home-state Republican Party even voted to censure him for his role in the negotiations.

“I’m an optimistic person, period,” Lankford said Thursday. “And that’s one of the reasons I’m still standing here after being hit in the face repetitively for a while.”

Johnson and other Republicans opposed to the deal have incorrectly argued, even before the text was released, that the bill would let more migrants into the country.

“We’ll no longer have people just entering the country, and maybe going to court in the next seven or ten years,” Sinema said Sunday on “Face the Nation” on CBS. “Instead, we’ll make swift justice. Folks who do qualify for asylum will be on a rapid path, six months or less, to start a new life in America. And those who do not qualify will quickly be returned to their home countries.”

Senate Republicans have said they want at least a few days to read the legislation before voting behind closed doors to see how much support the deal has in the conference. And some senators, including Lindsey Graham (R-S.C.), have said it’s unrealistic to begin voting on the legislation this week. If fewer than 25 Republicans support it, its fate is dim.

“I, for one, think it is a mistake to send this bill to the House without a majority of the Republican conference,” said Sen. Thom Tillis (R-N.C.), a booster of the negotiations who has argued he believes the deal would help solve the border crisis.

If the legislation does pass the Senate, it faces just a tough road in the House, where many Republicans have already come out against the legislation. The opposition puts pressure on Johnson, who is trying to corral a fragile and small GOP majority while simultaneously fending off threats to his job.

He told his colleagues in a letter over the weekend that failure to include him in Senate negotiations “has eliminated the ability for swift consideration” of the bill. Rep. Steve Scalise (R-La.), the House majority leader, declared in a social media post on Sunday that the deal would not receive a vote in the House.

Lankford responded to Johnson’s criticism on Sunday. “If the House wants to be able to take it up and amend it that is completely within the right of the House to be able to do that,” he said.