Donald Trump has said he is “unhappy” with a hard-won agreement to prevent a new government shutdown and finance construction of more barriers along the US-Mexico border, but he did not say he would not sign the measure.

Republican congressional leaders swung behind the proposed deal, selling it as a necessary compromise.

The president said he does not believe there will be a shutdown, which could have hit hundreds of thousands of federal workers again this weekend.

“Everything” is on the table, he said at the White House, but “we certainly don’t want to see a shutdown”.

He said he needs to look further at the agreement, which would grant far less than the 5.7 billion dollars (£4.4 billion) he wants for a long wall along the US-Mexico border.

“I can’t say I’m happy. I can’t say I’m thrilled,” he said. But one way or another, he said, “the wall’s getting built”.

Senior Republicans Mitch McConnell in the Senate and Kevin McCarthy in the House both claimed victory earlier, crowing about Democratic concessions on new border barriers and a late-stage battle over the ability of federal authorities to arrest and detain immigrants living illegally in the US.

“You’ve got to remember where Nancy Pelosi was. She has said, ‘No money for a wall’. That’s not the case,” Mr McCarthy said. “The Democrats have now agreed to more than 55 miles of new barrier.”

However, negotiators said it is pretty much the deal Mr Trump could have got in December.

Republicans and the White House were desperate to avoid another bruising shutdown. They tentatively agreed on Monday night to far less money for Mr Trump’s border wall, settling for a figure of nearly 1.4 billion dollars (£1.1 billion), according to congressional aides.

The huge funding measure, which combines seven spending bills into one, runs through the fiscal year, which ends on September 30.

Details might not be released until Wednesday but the pact came in time to alleviate any threat of a second partial government shutdown this weekend.

At the White House on Tuesday, spokesman Hogan Gidley was noncommittal: “We want to focus on what’s actually in the document. Until we see that, it’s going to be very difficult to have a conversation about what we will and won’t accept.”

The agreement means 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. It closely mirrors Mr Trump’s original budget request from last winter.