He said he needs to look further at the agreement, which would grant far less than the $5.7 billion he wants for a long-promised wall along the U.S.-Mexico border. But one way or another, "the wall’s getting built, he said, raising the likelihood he’d be “supplementing things” and moving resources from “far less ... important areas” in the government.

Trump said he didn’t believe there would be another 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.”

Lawmakers tentatively agreed Monday night to a deal that would provide nearly $1.4 billion for border barriers, according to congressional aides. The huge funding measure, which combines seven spending bills into one, would run through the fiscal year, which ends on Sept. 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.

Negotiators said the deal is pretty much the same as one Trump could have gotten in December, before his resistance led to the first shutdown. Aides revealed details under condition of anonymity because the agreement is tentative.

Top Republicans Mitch McConnell in the Senate and Kevin McCarthy in the House both claimed victory, 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 U.S.

"You've got to remember where Nancy Pelosi was. She has said, 'No money for a wall.' That's not the case," McCarthy said on CNBC Tuesday morning. "The Democrats have now agreed to more than 55 miles of new barrier."

And Trump said in regard to transferring other funds, "We have a lot of money in this country and we're using some of that money — a small percentage of that money — to build the wall, which we desperately need."

Trump appeared to be referring to a White House plan to supplement the deal by using executive action to divert additional money from the federal budget for wall construction — a move that could face challenges in Congress or the courts. The administration has been laying the groundwork for Trump to declare a national emergency or invoke other executive authority to tap funds including money set aside for military construction and disaster relief.

“We’ll take as much money as you can give us, and then we will go off and find the money someplace else - legally - in order to secure that southern barrier,” acting White House Chief of Staff Mick Mulvaney told Fox News Friday, previewing the strategy. He said more than $5.7 billon had been identified.

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 Trump’s original budget request from last winter.

The compromise contains plenty to anger lawmakers on the right and left — more border fencing than many Democrats would like and too little for conservative Republicans — but its authors praised it as a genuine compromise that would keep the government open and allow everyone to move on.

“The specter of another shutdown” brought the two parties’ negotiators back together after talks broke off over the weekend, said Senate Appropriations Committee Chairman Richard Shelby, R-Ala.

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

This weekend, 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 the fres round of talks on Monday.

Asked if Trump would back the deal, Shelby said: “We believe from our dealings with them and the latitude they’ve given us, they will support it. We certainly hope so.”

Democrats carried more leverage into the talks after besting Trump on the 35-day shutdown but showed flexibility in hopes of winning 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, 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 on Feb. 10, the most recent date for which figures were available. Democrats said the number of beds would be ratcheted down to 40,520 by year’s end.

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.

The recent shutdown left more than 800,000 government workers without paychecks, forced postponement of the State of the Union address and sent Trump’s poll numbers tumbling. As support in his own party began to splinter, Trump surrendered after the shutdown hit 35 days, agreeing to the current temporary reopening without getting money for the wall.