Republican leaders in the House of Representatives were in disarray on Thursday after they were unable to secure the votes for a bill to provide the government with additional money to cope with the influx of unaccompanied children at the border and were forced to pull their own legislation in a dramatic last-minute move.



The climbdown left Washington’s response to the border crisis in chaos, with overwhelmed border authorities at risk of running out of resources before the end of summer.



After two months of fiery rhetoric about the urgent need to manage the surge in children arriving at the border, hire more immigration judges, bring in the National Guard and streamline the process of deporting undocumented migrants, lawmakers in Washington were facing the prospect of returning to their constituents having been unable even to give the impression of making progress.



At 3pm Thursday, Republican congressmen, who had been due to leave Washington, were instead forced to attend an emergency meeting in the basement of the Capitol building to discuss the crisis.



The upshot, according to multiple media reports, was a decision to delay the five-week congressional recess which was due to begin Thursday night. Another meeting was called for Friday morning, according to Politico.



Thursday afternoon saw a chaotic scene on Capitol Hill, as Republican members of the House were called to the basement meeting. There remained a possibility of a 11th-hour attempt to resuscitate the bill with a possible second attempted vote on Friday.



However, political damage had by then already been inflicted on the Republican leadership, which has been successfully confronted, once again, by Tea Party-aligned factions within their ranks, who were rallied to oppose the bill by Texas senator Ted Cruz.



The cancelled vote on the bill, which provided less than $700m to the administration to help deal with the flow of children from El Salvador, Honduras and Guatemala, was the first major test for a Republican leadership reshaped after the shocking electoral defeat of majority leader Eric Cantor.



In an act of political theatre good enough to have been scripted for a screenplay, Cantor – the victim of a primary upset at the hands of a Tea Party challenger in June – delivered his farewell speech on Thursday, shortly before the border legislation was scheduled to be put to a vote.



“We don’t always see eye to eye – even within our own parties – in this chamber,” he told his fellow representatives. “But that is how it is supposed to be.”



At that moment, Cantor’s replacement as majority leader, Kevin McCarthy, was working frantically alongside the speaker of the House, John Boehner, and the chief whip, Steve Scalise, to rally support for a vote the leadership had thought it could win.



Sensing the error of that judgment, the Republican leadership pulled the bill, arguing the lack of unity within the GOP was evidence of “intense concern within our conference” about president Barack Obama’s immigration policies.



“There are numerous steps the president can and should be taking right now, without the need for congressional action, to secure our borders and ensure these children are returned swiftly and safely to their countries,” Boehner and the other leaders said in a statement. “For the past month, the House has been engaged in intensive efforts to pass legislation that would compel the president to do his job and ensure it can be done as quickly and compassionately as possible.”



A failure to pass any legislation – which on Thursday afternoon remained a strong possibility – could do serious damage to the GOP just more than three months before November’s midterm elections, and so Republican leaders have been desperate to pass some kind of bill to manage the crisis caused by 57,000 Central American children arriving at the border since October.



The Republican leadership’s favoured bill was opposed by Senate Democrats, who have been pushing their own legislation, and the White House, which had been asking for $3.7bn in emergency funding and had threatened a veto of the House legislation, saying it placed “arbitrary and unrealistic demands on an already broken [immigration] system”.



Had the Republican legislation succeeded, therefore, it would have been a largely symbolic gesture aimed at showing voters that the divided GOP could take urgent action to solve a crisis, defying the party’s growing reputation for division and obstructionism.



The rival Senate bill, which would have given the administration $2.7bn of emergency funds, had Democratic support, but it was unclear on Thursday if it would proceed.



Boehner’s unexpected cancellation of the scheduled vote, just moments before it was due to be held, is likely to intensify questions about his future leadership.



Republicans currently enjoy a strong majority in the House of Representatives, but rebellions from a conservative block within the caucus have repeatedly tied Boehner’s hands, and led last fall to a government shutdown that damaged the party’s reputation.



Cruz, who was at the vanguard of the government shutdown movement, was instrumental this week in persuading Tea Party representatives to defy the leadership over the immigration bill.



The senator has argued that the Obama administration can not be trusted with any further resources. He also contends that the president’s deferral of deportations of young people who were brought to the US as children illegally by their parents – known as Dreamers – has acted as a magnet for illegal migrants.



That program, known as deferred action for childhood arrivals (DACA), has proved highly popular with Hispanic voters and the president is expected to renew it later in the year. The White House is even rumoured to be considering a move to expand the program to include other categories of undocumented migrants who would effectively be given a temporary reprieve from deportation proceedings.



Any such move would enrage Republicans, who are turning opposition to immigration reform into a touchstone issue for their party.



With that in mind, Boehner made several last-minute concessions intended to placate the restive members of the conservative wing of his party in the run-up to Thursday’s scheduled vote.



Two weeks ago, a working group established by Boehner said that $1.5bn was required to respond to the sudden increase in children arriving at the border.



In a concession to fiscal conservatives, the bill supported by the Republican leadership provided for less than half that amount: just $659m. It also contained a provision that reworked a 2008 anti-trafficking law that critics say has slowed the deportation process, but that Democrats have insisted is essential to giving children fair hearings on their asylum claims.



Finally, amid growing Republican concern that Boehner was still not satisfying the restive fringe elements in the party, the speaker offered a separate bill that would have ended DACA. House Republicans passed a virtually identical bill last year, but the move was intended as nothing more than a sweetener.



The vote on the anti-Dreamer bill would only be held, Republican sources said, if the main border bill was passed first. As it turned out, both bills were pulled.



The number of unaccompanied children coming from El Salvador, Honduras and Guatemala has been on the rise since 2011, but there was a sudden and unexpected spike in the middle of this year, overwhelming authorities. In large part, the children, some of whom are accompanied by their mothers, have been fleeing intense, drug cartel-related violence that has ravaged parts of Central America.



More recently, the numbers have been falling, a decline US officials attribute to a publicity campaign in the childrens’ countries of origin that attempts to persuade them not to undertake the perilous journey.



Experts say that between 60-70% of children claiming asylum from El Salvador, Honduras and Guatemala are granted it. Under current rules, children are put into care, often after being placed with US-based relatives, while they wait for their case to be heard.



However the surge in children has resulted in their being housed, temporarily, in military bases in Texas, while others are relocated to sometimes unwelcoming towns and cities across the US. Coping with the humanitarian crisis, and finding ways to return the children to their countries of origin, has become the dominant domestic issue of the summer.



The US is not the only country that has seen a spike in children from the trio of Central American countries that have been ravaged in recent years by violence linked to drug traffickers.



Figures from the UN refugee agency indicate that asylum applications from El Salvador, Honduras and Guatemala grew by 25% in the US from 2012 to 2013. Asylum applications from those same three countries have grown by 68% in Mexico and 238% in Nicaragua, however.



Still, it is the US where the issue has been transformed into the biggest political controversy, complicating Obama’s long-term but seemingly unachievable aim of enacting comprehensive immigration reform before his presidency ends in 2016.