House Republicans overcame divisions within their own party and voted Friday night to pass a $694 million bill aimed at addressing the recent surge of migrants on the southern border.

One Democrat voted in favor of the legislation and four Republicans defected, leaving only a slim margin of victory for the GOP. The bill passed 223 to 189.

It was a big win nonetheless for Republican leaders, who just a day ago were ready to abandon efforts to pass a border bill when they failed to come up with the 218 GOP votes needed to pass it.

The GOP made a sudden decision to postpone the recess that was to begin Thursday afternoon. They made revisions to the legislation Thursday night, negotiating in a private meeting with some of the staunchest Republican opponents of the bill.

Then they aired the new version at a lengthy morning huddle with the rank and file, finally convincing enough Republicans ensure they could pass something on Friday.

“This is a fair bill,” House Appropriations Committee Chairman Hal Rogers, R-Ky., said. “It solves a crisis on our border, it does so in a financially responsible way, it strengthens the border, it humanely treats those who are in our custody now and arranges them to be humanely returned to their home countries.”

The bill has no chance of becoming law, however. The Obama administration has signaled the president would veto the bill, and Senate Majority Leader Harry Reid, D-Nev., adjourned the Senate for the summer recess, which will last until Sept. 8.

Democrats made the case during debate that the crisis on the border was a humanitarian one and not a border security problem.

The House bill, they said, would hurt child migrants by speeding deportations rather than ensuring they are not being exploited.

“These bills do not reflect America's values and our highest ideals,” House Minority Whip Steny Hoyer, D-Md., argued.

The GOP bill was split into two parts, neither of which held appeal for Democrats.

The second bill, still under debate Friday night, would block funding for future expansion of President Obama’s 2012 executive action that stops the deportation of young people who came here illegally as children. Republicans say this executive order has served as the lure that has attracted Central American children and families to come here, believing they can also be granted legal status.

“This border crisis is of the president’s own making,” Rep. Keith Rothfus, R-Pa., said.

The main legislative vehicle approved Friday night provides $659 million for humanitarian aide, strengthened border security and additional immigration judges. It also adds $35 million to grant border state governors the autonomy to pay for sending the National Guard to the border without needing federal funds.

The bill also changes a 2008 trafficking victims law so that the Obama administration will be able to speed deportation of minors from Central America, where most of the children have migrated from.

Changing the 2008 law was the biggest point of disagreement between Republicans and Democrats, who backtracked from their initial support for speeding deportations of children after immigration rights groups pressured them.

Rep. Nita Lowey, D-N.Y., the top Democrat on the House Appropriations Committee, called the bill “a controversial revision of immigration policy with limited money thrown in as an afterthought.”

The legislation makes changes aimed at boosting border security, including a provision authored by House Judiciary Committee Chairman Bob Goodlatte that would permit U.S. Border Patrol agents to drive onto federally protected lands, which are often used by human smugglers and drug dealers who know they are out of the reach of U.S. authorities.

“While the bill is not perfect, it does give law enforcement many of the tools they have requested,” Goodlatte said.

Still, the bill wasn’t good enough for a handful of Republicans, who said it fell short in a number of areas.