Congressional negotiators have reached an agreement to prevent a US government shutdown and providing finance for the construction of new barriers along the US-Mexico border.
Representatives from both parties overcame a late-stage hang-up over immigration enforcement issues that had threatened to scuttle the talks.
Republicans were desperate to avoid another bruising shutdown. They tentatively agreed to far less money for President Donald Trump's border wall than the White House's $US5.7 billion ($NZ8.4b) wish list, settling for a figure of nearly $1.4 billion, according to congressional aides. The funding measure is through the fiscal year, which ends on 30 September.
The agreement means 88km of new fencing - constructed through existing designs such as metal slats instead of a concrete wall - but far less than the 350km the White House demanded in December. The fencing would be built in the Rio Grande Valley in Texas.
"With the government being shut down, the spectre of another shutdown this close, what brought us back together I thought tonight was we didn't want that to happen" again, said Republican Senate Appropriations Committee Chairman Richard Shelby.
Details will not be officially released until tomorrow, but the pact came in time to alleviate any threat of a second partial government shutdown this weekend. Aides revealed the details under condition of anonymity because the agreement is tentative.
"Our staffs are just working out the details," said Democratic House Appropriations Committee Chairwoman Nita Lowey.
The pact also includes increases for new technologies such as advanced screening at border entry point, humanitarian aid sought by Democrats, and additional customs officers.
Yesterday, Mr Shelby pulled the plug on the talks over Democratic demands to limit immigrant detentions by federal authorities, frustrating some of his fellow negotiators, but Democrats yielded ground on that issue in a fresh round of talks today.
Asked if Mr Trump would back the deal, Mr Shelby said: "We believe from our dealings with them and the latitude they've given us, they will support it. We certainly hope so."
Mr Trump travelled to El Paso, Texas, for a campaign-style rally today focused on immigration and border issues. He has been adamant that Congress approve money for a wall along the Mexican border, though he no longer repeats his 2016 mantra that Mexico will pay for it, and he took to the stage as lawmakers back in Washington were announcing their breakthrough.
"They said that progress is being made with this committee," Mr Trump told his audience, referring to the congressional bargainers.
"Just so you know, we're building the wall anyway."
Democrats hit their own wall
Democrats carried more leverage into the talks after besting Mr Trump on the 35-day shutdown but showed flexibility in hopes of winning his signature. After yielding on border barriers, Democrats focused on reducing funding for detention beds to curb what they see as unnecessarily harsh enforcement by Immigration and Customs Enforcement, or ICE.
The agreement yielded curbed funding, overall, for ICE detention beds, which Democrats promised would mean the agency would hold fewer detainees than the roughly 49,000 detainees held two days ago, the most recent date for which figures were available. Democrats claimed the number of beds would be reduced to 40,520.
But a proposal to cap at 16,500 the number of detainees caught in areas away from the border - a limit Democrats say was aimed at preventing overreach by the agency - ran into its own Republican wall.
Democrats dropped the demand in the latest round of talks, and the mood in the Capitol improved markedly.
Mr Trump met earlier today with top advisers in the Oval Office to discuss the negotiations. He softened his rhetoric on the wall but ratcheted it up when alluding to the detention beds issue.