WASHINGTON — Congressional negotiators reached agreement to prevent a government shutdown and finance construction of new barriers along the U.S.-Mexico border, overcoming 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 Monday night to far less money for President Donald Trump's border wall than the White House's $5.7 billion 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 Sept. 30.

It's not clear whether Trump will support the deal, although GOP negotiators said they were hopeful.

The agreement means 55 miles (88 kilometers) of new fencing — constructed through existing designs such as metal slats instead of a concrete wall — but far less than the 215 miles (345 kilometers) 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 specter of another shutdown this close, what brought us back together I thought tonight was we didn't want that to happen" again, said Senate Appropriations Committee Chairman Richard Shelby, R-Ala.

Details won't be officially released until Tuesday, 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 House Appropriations Committee Chairwoman Nita Lowey, D-N.Y.

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 a fresh 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."

But Fox News Channel's Sean Hannity, a Trump ally, said the barrier money in the agreement was inadequate. He warned late Monday that "any Republican that supports this garbage compromise, you will have to explain."

Trump traveled to El Paso, Texas, for a campaign-style rally 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 lawmakers back in Washington were announcing their breakthrough.

"They said that progress is being made with this committee," 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 Trump on the 35-day shutdown but showed flexibility in hopes on 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 detainees held on Feb. 10, the most recent date for which figures were available. 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.

Trump met 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," 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 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.

The president's supporters have suggested that Trump could use executive powers to divert money from the federal budget for wall construction, though he could face challenges in Congress or the courts.

The negotiations hit a rough patch Sunday amid a dispute over curbing ICE, the federal agency that Republicans see as an emblem of tough immigration policies and Democrats accuse of often going too far.

According to ICE figures, 66 percent of the nearly 159,000 immigrants it reported detaining last year were previously convicted of crimes. Reflecting the two administration's differing priorities, in 2016 under President Barack Obama, around 110,000 immigrants were detained and 86 percent had criminal records.

Few convictions that immigrants detained last year had on their records were for violent crimes. The most common were for driving while intoxicated, drugs, previous immigration convictions and traffic offenses.

The border debate got most of the attention, but it's just part of a major spending measure to fund a bevy of Cabinet departments. A collapse of the negotiations would have imperiled another upcoming round of budget talks that are required to prevent steep spending cuts to the Pentagon and domestic agencies.


Become a #ThisIsTucson member! Your contribution helps our team bring you stories that keep you connected to the community. Become a member today.

Associated Press writers Catherine Lucey and Lisa Mascaro in Washington and Jill Colvin in El Paso, Texas, contributed to this report.