Republican and Democrat negotiators reached a finance deal late on Monday to prevent another shutdown of the US government – even as Donald Trump threatened their progress by insisting he would “build the wall anyway”.

The agreement reached by politicians from both sides of Congress included nearly $1.4bn (£1bn) for 55 miles of new fencing along the US-Mexico border.

The construction will follow existing designs, likely with metal slats, and would be considerably less of an undertaking than the 215 miles of concrete wall for which the White House demanded $5.7bn (£4bn) in December.

That demand, which Mr Trump refused to budge on, led to the longest partial shutdown of the US government in history. More than 800,000 federal employees went unpaid over a period of 35 days, postponing the State of the Union address and hurting Mr Trump’s poll numbers.

A bipartisan group of House and Senate politicians had “reached an agreement in principle”, said Senate Appropriations Committee chair Richard Shelby.

Trump Texas rally: Lies, executing babies and attacks on BBC cameramen Show all 20 1 /20 Trump Texas rally: Lies, executing babies and attacks on BBC cameramen Trump Texas rally: Lies, executing babies and attacks on BBC cameramen Supporters yell as protesters are removed at Trump rally in Texas on February 11 Getty Trump Texas rally: Lies, executing babies and attacks on BBC cameramen A supporter dressed as a border wall before the rally Reuters Trump Texas rally: Lies, executing babies and attacks on BBC cameramen A man is restrained after assaulting members of the media including a BBC cameraman at the rally AP Trump Texas rally: Lies, executing babies and attacks on BBC cameramen President Trump arrives for a rally in El Paso AFP/Getty Trump Texas rally: Lies, executing babies and attacks on BBC cameramen Trump supporters react as a couple are escorted from their seats Reuters Trump Texas rally: Lies, executing babies and attacks on BBC cameramen A supporter shows off a Trump doll while waiting for the rally Reuters Trump Texas rally: Lies, executing babies and attacks on BBC cameramen Linda Padilla Dewiler, originally from Mexico, poses with a sign as Trump supporters gather to attend his rally AFP/Getty Trump Texas rally: Lies, executing babies and attacks on BBC cameramen A supporter sports political badges on his cap Reuters Trump Texas rally: Lies, executing babies and attacks on BBC cameramen Supporters hold signs, one holds an Israel flag, as they cheer for the president AFP/Getty Trump Texas rally: Lies, executing babies and attacks on BBC cameramen President Trump addresses the rally AP Trump Texas rally: Lies, executing babies and attacks on BBC cameramen President Trump addresses the rally in front of a large "FINISH THE WALL" banner AP Trump Texas rally: Lies, executing babies and attacks on BBC cameramen President Trump addresses the rally as supporters hold pro-border wall signs Getty Trump Texas rally: Lies, executing babies and attacks on BBC cameramen President Trump addresses the rally as supporters hold pro-border wall signs AP Trump Texas rally: Lies, executing babies and attacks on BBC cameramen Supporters cheer at the rally AFP/Getty Trump Texas rally: Lies, executing babies and attacks on BBC cameramen Supporters cheer during the rally AP Trump Texas rally: Lies, executing babies and attacks on BBC cameramen Supporters cheer at the rally AFP/Getty Trump Texas rally: Lies, executing babies and attacks on BBC cameramen Supporters cheer at the rally AFP/Getty Trump Texas rally: Lies, executing babies and attacks on BBC cameramen Supporters cheer the president AFP/Getty Trump Texas rally: Lies, executing babies and attacks on BBC cameramen Supporters cheer the president AFP/Getty Trump Texas rally: Lies, executing babies and attacks on BBC cameramen Supporters wait for the president to arrive at the rally Getty

Nita Lowey, his counterpart in the House, said their “staffs are just working out the details”, which would be announced in full on Tuesday.

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.”

The agreement includes increases for new technologies such as advanced screening at border entry points, humanitarian aid sought by Democrats, and additional customs officers.

And while Republicans conceded ground on the funding for a wall, the Democrats softened their position on demands to limit immigrant detentions by federal authorities.

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.”