Democratic leadership in the House signed onto the GOP-led Senate's proposal Thursday after a fight over what should specifically be in the bill.

Amid a raging nationwide debate over the dire conditions of migrant detention centers, the U.S. House and Senate rushed to pass legislation this week to address a crisis at the U.S-Mexico border.

The Democratic-controlled House and the Republican-controlled Senate initially approved separate bills with about $4.5 billion aimed at improving conditions in overcrowded migrant detention centers. The bills proposed allocating money differently and offered different levels of assurance that the Trump administration puts the appropriations to their intended use.

But as calls to address the humanitarian situation at the border grew, leaders in both chambers were on a collision course as they scrambled to address the situation ahead of a weeklong July 4 recess. The House ultimately passed the Senate's version, which now heads to President Donald Trump, who is expected to sign it. Here's a look at how the bills compared.

What’s in the Senate Bill?

The Senate bill that the House ultimately approved with no changes pushes billions toward alleviating the pressures on detention centers and providing emergency humanitarian aid to migrant children. That version of the bill comes with far fewer restrictions on the implementation of its funds.

The language in the Senate bill is the product of a fairly robust bipartisan effort, and it passed the upper chamber by a resounding 88-4 margin with the support of the Senate's two Texans — Republicans John Cornyn and Ted Cruz. It passed the House in 305-102.

The vast majority of the Senate's legislation is aimed at alleviating the squalid conditions detained migrant children are facing. It sends $2.9 billion to restore the waning resources of the Department of Health and Human Services.

The majority of the remaining funding — some $1.3 billion — will go to the Department of Homeland Security. The bulk of this appropriation is designated for Customs and Border Patrol to improve the conditions in border facilities, expand medical care, and provide better access to essential items like clothing, hygiene products and baby formula. According to The New York Times, these improvements would not include more beds at detention facilities.

Among the provisions in the Senate bill that originally met resistance in the House was $145 million allocated to the Department of Defense to fund military expenses along the border, including facility maintenance, medical assistance and surveillance and enforcement operations. Democrats sought to keep the Pentagon out of any border aid efforts.

Also drawing pushback on the House side were appropriations in the Senate bill for enforcement, including more than $200 million in funding for Immigration and Customs Enforcement and $110 million in overtime funding for Customs and Border Protection employees.

What was in the House bill?

Only three Republicans supported the House's original version of the bill, including one Texan, Will Hurd of Helotes. The funding designations of the House bill were carefully crafted to funnel appropriations towards improving conditions at detention facilities and extending aid and legal services to migrants.

Most of the House's appropriations — some $2.9 billion — would have gone to the Department of Health and Human Services to fund legal services for migrant children who have been detained and to relieve overcrowding by creating more licensed facilities to hold migrant children.

And of the remaining $1.5 billion in the House bill, the majority would have gone to the Department of Homeland Security, a sprawling network of agencies that includes U.S. Immigration and Customs Enforcement.

But the House bill was careful to spell out how the Department of Homeland Security would have been allowed to use the new funding, requiring the agency to ensure it has an adequate supply of necessities like food, water, blankets, soap, toothpaste and diapers. Extreme shortages of such products have stoked widespread outrage and served as a flashpoint in the national conversation about the situation at the border over the last week.

Still, nearly $800 million of Department of Homeland Security funding in the House bill was designated for the expansion of “soft-side and modular facilities” — the overflow shelters often referred to as “tent cities” — an expansion of detention accommodations that critics have argued are inhumane.

Unique to the House bill was $17 million in allocations to the Department of Justice prescribing legal services for children and $20 million to ICE to fund alternatives to physical migrant detention centers.

Several provisions added to the House bill in the hours before it passed were aimed at appeasing holdout members of the Congressional Hispanic and House Progressive caucuses. These amendments would have established even tighter restrictions on the use of humanitarian aid funding and stringent standards on the care and resources provided to detained children, including a 90-day limit on the detention of unaccompanied children at influx shelters, demands that U.S. Customs and Border Protection adopt higher standards of medical care and hygiene for unaccompanied children, and a guarantee of translation services and legal assistance for detainees.

The biggest differences

The two chambers were furthest apart on how much leeway to give the Trump administration with this new funding. Perhaps the most significant distinction in the House bill were the “guardrails,” as some members have called them — provisions intended to prevent the misappropriation of funds by ICE and the Trump administration. Republicans argued that these restrictions on implementation wouldseverely limit the ability for the Trump administration to administer a unilateral response in an emergency situation. Those so-called guardrails were aimed at preventing the White House from redirecting appropriations away from humanitarian aid and toward immigration enforcement programs.

According to U.S. Rep. Veronica Escobar of El Paso, who emerged as a lead proponent for the lower chamber's version of the bill, the most important of these safeguards was a prohibition on the use of funds for anything other than their designated purpose.

“We cannot give a president like this a blank check. It just would be disastrous,” Escobar told the Tribune on Wednesday. “We’ve seen him use funding in order to foment chaos and, really, to implement cruelty.”

The House bill was also far more specific in how some of the funds — especially those going to the Department of Homeland Security — could have been spent, down to granular notes about what should be spent on toiletries.

And the House bill also made it easier for lawmakers to check on the detention facilities. The Senate bill says that members of Congress may visit detention facilities with two days advanced notice, while the House bill would have let them show up at detention facilities unannounced.

But ultimately Democratic House Speaker Nancy Pelosi opted to pass the Senates version after failing to bring together the more liberal and centrist members of her party.

“In order to get resources to the children fastest, we will reluctantly pass the Senate bill,” Pelosi wrote in a letter to Democratic lawmakers, according to The New York Times.