(WASHINGTON) — The GOP-held Senate on Wednesday passed a bipartisan $4.6 billion measure to deliver aid to the southern border before the government runs out of money to care for thousands of migrant families and unaccompanied children.

The sweeping 84-8 vote came less than 24 hours after the Democratic-controlled House approved a companion measure backed by party liberals that was weighed down by a White House veto threat and bipartisan rejection by the Senate.

Republicans and the White House far prefer the Senate measure but House Speaker Nancy Pelosi is pressing for quick negotiations to merge the bills — promising that Democrats won’t knuckle under to demands to send the Senate bill directly to President Donald Trump without changes.

The Senate vote sent the must-pass legislation measure back the Democratic-controlled House. Next steps are unclear, but Pelosi quickly dismissed speculation that the Democratic-controlled House will simply accept the Senate measure, which cleared a key committee last week with just one dissenting vote. Asked if the House would pass the Senate bill and send it to Trump, Pelosi said, “No.”

Pelosi called Trump Wednesday afternoon to discuss the measure. “There’s some improvements that we think can be reconciled,” Pelosi told reporters.

Trump said passing the legislation was urgent as he left the White House for Japan and he appeared to leave the door open for negotiations.

“We are moving along very well with a bipartisan bill in the Senate,” Trump said. “It’s very far along and I believe the House is also going to also be getting together with the Senate to get something done. It’s humanitarian aid. It’s very important.”

The final outcome isn’t clear. An impasse could imperil passage of the measure, which is needed soon before federal agencies caring for migrants are hamstrung by lack of money.

Congress plans to leave Washington in a few days for a weeklong July 4 recess, and pressure

is intense to wrap up the legislation before then. Failure to act could bring a swift political rebuke and accusations of ignoring the plight of innocent immigrant children who are living in overcrowded, often inadequate federal facilities.

The Senate vote comes less than 24 hours after the House passed its version along party lines after Pelosi quelled a mini-revolt by progressives and Hispanic lawmakers who won relatively modest changes to the legislation. The funding is urgently needed to prevent the humanitarian emergency on the U.S.-Mexico border from worsening.

Senate Majority Leader Mitch McConnell, R-Ky., blasted the House bill earlier Wednesday.

“It’s a go-nowhere proposal filled with poison pill riders which the president has indicated he would veto,” McConnell said. “They had to drag their bill way to the left to earn the support of most Democrats. As a result, the House has not made much progress toward actually making a law, just more resistance theater.”

Asked Wednesday if he’s open to adding some language sought by the House, McConnell said, “We’re working on finishing up this week and getting it to the president.”

The Senate rejected the House bill by a 55-37 vote.

“The Senate has a good bill. Our bill is much better,” Pelosi, D-Calif., told her Democratic colleagues earlier in the week. On Wednesday, Pelosi told The Associated Press that she had “a good conversation” with Trump and that “I don’t know if the president is even going to be signing the Senate bill.”

Both House and Senate measures contain more than $1 billion to shelter and feed migrants detained by the border patrol and almost $3 billion to care for unaccompanied migrant children who are turned over the Department of Health and Human Services. The Senate measure is not as strict in setting conditions on the delivery of funding to care for unaccompanied children and contains funding opposed by House Democrats for the Pentagon and to ease a payroll pinch at Immigration and Customs Enforcement.

Both House and Senate bills ensure funding could not be shifted to Trump’s border wall and would block information on sponsors of immigrant children from being used to deport them. Trump would be denied additional funding for Immigration and Customs Enforcement detention beds.

“The President’s cruel immigration policies that tear apart families and terrorize communities demand the stringent safeguards in this bill to ensure these funds are used for humanitarian needs only — not for immigration raids, not detention beds, not a border wall,” said House Appropriations Committee Chairwoman Nita Lowey, D-N.Y.

The White House has threatened to veto the House bill, saying it would hamstring the administration’s border security efforts, and is only reluctantly backing the Senate measure — which received only a single “nay” vote during a committee vote last week.

Lawmakers’ sense of urgency to provide humanitarian aid was amplified by recent reports of gruesome conditions in a windowless Border Patrol station in Clint, Texas, where more than 300 infants and children were being housed. Many were kept there for weeks and were caring for each other in conditions that included inadequate food, water and sanitation.

The Border Patrol reported apprehending nearly 133,000 people last month — including many Central American families — as monthly totals have begun topping 100,000 for the first time since 2007. Federal agencies involved in immigration have reported being overwhelmed, depleting their budgets and housing large numbers of detainees in structures meant for handfuls of people.

In a letter Monday threatening the veto, White House officials told lawmakers they objected that the House package lacked money for beds the federal Immigration and Customs Enforcement agency needs to let it detain more migrants. Officials also complained in the letter that the bill had no money to toughen border security, including funds for building Trump’s proposed border wall.

Contact us at editors@time.com.

SPONSORED FINANCIAL CONTENT

Read More From TIME

EDIT POST