WASHINGTON — Congressional negotiators said Monday night that they had reached an "agreement in principle" to fund border security and prevent another partial government shutdown on Saturday.

Senate and House appropriators from both parties who emerged from the evening meeting would not comment on the details of the deal because they said staff was still working on last-minute logistics. They also would not say when they would release the text of the bill they plan on proposing.

The agreement came in a third round of talks on Capitol Hill Monday following a weekend of stalled negotiations, and came just ahead of a Make America Great Again rally that President Donald Trump was holding in El Paso, Texas on Monday night.

Top Democratic appropriators Rep. Nita Lowey of New York and Sen. Patrick Leahy of Vermont met behind closed doors with their Republican counterparts, Rep. Kay Granger of Texas and Sen. Richard Shelby of Alabama.

Over the weekend, a new sticking point had emerged in the negotiations: not the border wall, but the number of detention beds for undocumented immigrants who enter the country.

“I'm hoping we can get off the dime later today or in the morning because time is ticking away,” Shelby, who’s leading negotiations as part of a bipartisan, bicameral conference committee, said on “Fox News Sunday.” “We got some problems with the Democrats dealing with ICE, that is detaining criminals that come into the U.S. and they want a cap on them. We don't want a cap on that.”

“I think the next 24 hours are crucial,” Shelby added during the Sunday morning interview.

A senior Democratic aide told NBC News on Sunday that Senate Republicans would need to accept "limits" on Trump immigration policies in the form of a cap on the bed count: "A deal that includes new physical barriers must all include limits on the number of ICE detention beds. If Senate Republicans won’t compromise with us on both, we can’t reach a deal.”

Senate Majority Leader Mitch McConnell, R-Ky., said Monday that the Democrats' demand would be a "total nonstarter with the White House.

"House Democrats decided to add a poison-pill demand into the conversations at the 11th hour. It’s a new demand. It’s extreme: A hard, statutory cap on the number of illegal immigrants who could be detained by the federal government," he said. "This is a poison pill that no administration — not this one, not the previous one — would or should ever accept."

Democrats “don’t want to give us the beds,” President Donald Trump said Monday during a meeting at the White House with a group of sheriffs.

“These are people, they kidnap people. These are people the Democrats want to come into our society. I don’t think so," he said. "I don’t know, maybe we’re in a different country than I know of.”

Democrats say they don’t want more detention beds because they think the more humane policy is to allow asylum-seekers and other immigrants without criminal records to be released while they await their immigration proceedings.

In a letter sent to negotiators during the last round of talks in January, the White House Office of Management and Budget requested $4.2 billion for 52,000 beds, $798 million more than current funding levels.

Democrats were proposing a cap of 16,500 detention beds.

“A cap on ICE detention beds will force the Trump administration to prioritize deportation for criminals and people who pose real security threats, not law-abiding immigrants who are contributing to our country,” Rep. Lucille Roybal-Allard, D-Calif., chairwoman of the Homeland Security Appropriations subcommittee and a member of the conference committee, said in a statement Sunday.

A cap on detention beds, a House Democratic aide said Monday, would also rein in the Trump administration’s agenda on deportations.

Sen. John Cornyn, R-Texas, the former Senate majority whip, said on Twitter Monday that the Democratic demand was "arbitrary, and will allow criminals to rove the homeland freely. Rs believe some undocumented immigrants who commit crimes in the U.S. shouldn't be subject to a cap.”

Rep. Dan Kildee of Michigan, the Democratic Caucus chief deputy whip, was asked Monday on CNN if drawing a line on the bed count issue would be worth risking another government shutdown.

“All I can say is, this is a priority for us,” he responded. “The issue that we’ve been raising is the number of beds that are available, forcing the administration to prioritize the use of those beds, which we naturally believe would force them to be used for actual people who may present some risk or danger.”

White House chief of staff Mick Mulvaney, who hosted several members of Congress at Camp David over the weekend, said on NBC’s “Meet the Press” on Sunday that the White House "absolutely cannot" rule out another government shutdown.

"Let's say the hard-core left wing of the Democrat Party prevails in this negotiation and they put a bill on the president's desk with, say, zero money for the wall, or $800 million, an absurdly low number. How does he sign that?" he said.

Republicans had started to discuss the idea of proposing a one-year continuing resolution that would keep funding at current levels, but it had not been clear that Democrats, who control the House, would accept that, or whether President Trump would sign it.

Trump tweeted Sunday that negotiations were going poorly. “The Border Committee Democrats are behaving, all of a sudden, irrationally. Not only are they unwilling to give dollars for the obviously needed Wall (they overrode recommendations of Border Patrol experts), but they don’t even want to take muderers [sic] into custody! What’s going on?”