Democrats and Republicans have reached an agreement to prevent a US government shutdown and finance construction of new barriers along the US-Mexico border.
Republicans agreed in principle to far less money for Donald Trump's border wall than the White House's £4 billion wish list, settling for a figure of nearly £1 billion, according to congressional aides.
Mr Trump insisted that the wall would be built anyway.
The agreed figure equates to 55 miles of new fencing - constructed through existing designs such as metal slats instead of a concrete wall - but far less than the 215 miles the White House demanded in December.
The fencing would be built in the Rio Grande Valley in Texas.
"We reached an agreement in principle," said Senate Appropriations Committee chairman Richard Shelby.
"Our staffs are just working out the details," said House Appropriations Committee chairwoman Nita Lowey.
Details will not be officially released until Tuesday, but the pact came in time to alleviate any threat of a second partial government shutdown this weekend.
The agreement also includes increases for new technologies such as advanced screening at border entry point, humanitarian aid sought by Democrats, and additional customs officers.
This weekend, 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 on Monday.
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."
A collapse of the negotiations would have imperilled another upcoming round of budget talks that are required to prevent steep spending cuts to the Pentagon and domestic agencies.
Mr Trump travelled to El Paso, Texas, for a campaign-style rally on Monday night 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 politicians 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 carried more leverage into the talks after besting Mr Trump on the 35-day shutdown but showed flexibility in hopes on winning Mr Trump’s 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 (ICE).
The agreement yielded curbed funding, overall, for ICE detention beds, which Democrats promised would mean the agency would hold fewer detainees than the current average of 49,000 detainees held each day. Democrats claimed the number of beds would be ratcheted down 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 Monday round of talks, and the mood in the Capitol improved markedly.
Mr Trump met on Monday afternoon 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.
“We can call it anything. We’ll call it barriers, we’ll call it whatever they want,” Mr Trump said. “But now it turns out not only don’t they want to give us money for a wall, they don’t want to give us the space to detain murderers, criminals, drug dealers, human smugglers.”
The recent shutdown left more than 800,000 government workers without pay, forced postponement of the State of the Union address and sent Mr Trump’s poll numbers tumbling.