Sen. Richard Shelby, R-Ala., chair of the Senate Appropriations Committee, leaves the chamber as he and other senior bipartisan House and Senate negotiators try to negotiate a border security compromise in hope of avoiding another government shutdown, at the Capitol in in Washington, Monday, Feb. 11, 2019. Credit: J. Scott Applewhite | AP

Key lawmakers expressed guarded optimism late Monday that they would be able to avoid another government shutdown, saying they were making progress in a series of late-stage meetings meant to resolve disputes about immigration rules.

The outcome remains uncertain, as negotiators must cut a deal before midnight Friday on funding for a series of federal departments. But after back-to-back-to-back meetings between party leaders, they signaled the pathway for a deal had emerged, even if some details remained unsettled.

Sen. Patrick J. Leahy (D-Vt.) said he was hopeful a deal could be reached Monday evening. “We’re working in good faith. I believe [Republicans] are too,” he said.

Leahy was meeting with Senate Appropriations Commitee Chairman Richard C. Shelby (R-Ala.), House Appropriations Committee Chairman Nita M. Lowey (D-N.Y.) and Rep. Kay Granger (R-Tex.). The lawmakers are on a bipartisan conference committee charged with striking a border security deal to stave off a shutdown, which would begin Saturday unless the House and Senate pass legislation and President Trump signs it into law.

The discussions are the first major political test for Democrats and Republicans after a 35-day government shutdown froze the paychecks of 800,000 federal workers until Trump backed away from demands late last month. Congress was given a short reprieve to try to reach a longer-term agreement, with a focus on border security and immigration rules.

Negotiators had made steady progress behind closed doors until rifts spilled into the open in recent days, with Democrats and Republicans angrily accusing each other of trying to sabotage the talks and raising fears that another shutdown was imminent.

The central stumbling block was Democrats’ insistence on limiting the number of undocumented immigrants who could be detained. The White House wants more flexibility, saying it needs the ability to tailor rules for felons and violent criminals.

As the stakes came into focus Monday, leaders from both parties sought to bridge this issue and revive a compromise.

Granger offered a hint of optimism, telling reporters they were “possibly” moving closer to avoid a shutdown. And Lowey said she was hopeful as well.

“We’re still talking,” she said during a break between meetings. “As long as there’s talking, there’s life.”

Shelby urged caution but said there was a chance negotiators could reach a sweeping deal that addressed many of the unresolved issues, potentially eliminating the need to revisit budget and immigration issues until October.

“At the moment, I think odds have improved, but they still have not crystallized,” Shelby said.

White House officials and lawmakers viewed Monday’s meeting as a pivotal juncture that could determine whether more than a dozen federal agencies remain operating in five days.

President Donald Trump attempted to put the onus on Democrats to broker a deal. Asked by reporters Monday if the government would shut down again on Saturday, he responded “that’s up to the Democrats.”

Lawmakers had hoped to reach an agreement by midday Monday, a timeline they thought was sufficient to win House and Senate approval this week. But talks broke down over the weekend, leading to acrimonious finger-pointing and angry outbursts from the White House.

To avert a partial shutdown set to begin Saturday, the House and Senate must pass identical spending bills that Trump would then need to sign into law.

If no deal emerges, lawmakers and the White House would have to find some other way to keep the government open. One option under consideration would be to pass a package of full-year spending bills for all impacted government agencies except the Homeland Security Department, which could then potentially be funded on a short-term basis, according to two officials familiar with the discussions.

The White House is open to that approach, and Lowey said Democrats could be open to it if necessary. The officials spoke on the condition of anonymity to discuss internal deliberations.

Trump’s demands for funds to build a border wall, which prompted the 35-day government shutdown that ended late last month, are not the central sticking point in the current impasse. Instead, the two sides are at odds over Democrats’ attempt to impose a new cap on detentions of immigrants apprehended within the U.S. — as opposed to at the border.

Negotiators refer to this cap as representing the number of “beds” that the government can use for detentions.

Republicans want to exclude immigrants charged with or convicted of certain crimes from the cap, arguing U.S. Immigration and Customs Enforcement might not otherwise have the ability to detain dangerous criminals. Democrats say excluding people from the cap would render it toothless, as they seek to rein in the Trump administration’s aggressive enforcement policies.

Republicans went on the attack Monday over Democrats’ demands, which McConnell called an “absurd last-minute poison pill” and “a get-out-of-jail-free card for criminals because the radical left doesn’t like U.S. Immigration and Customs Enforcement.”

“This provision would rightly be a total non-starter for the White House,” McConnell said on the Senate floor.

But Democrats have said the Republican descriptions mischaracterize their position. They said the White House’s insistence on excluding people charged or convicted of crimes, even nonviolent drug offenses, would give the White House almost limitless power to detain people and make existing rules irrelevant.

“How the government deals with ICE is a very important issue,” Lowey said. “And that’s why the beds are so critical to this negotiation. Period.”

Trump administration officials said on Sunday that the chances of another government shutdown had increased markedly over the weekend. White House counselor Kellyanne Conway on Monday said Democrats’ demands were to blame for the renewed risk of a shutdown.

“The president is not a part of these negotiations. He’s waiting for a bill to come to his desk that he can sign into law,” she said on Fox News Channel. Democrats are “the ones hurtling us toward a shutdown,” Conway said.

Lawmakers frequently run up against deadlines to pass spending bills, but it’s unclear whether they can rely on the most commonly used fallback plans this time. Often, lawmakers will seek to pass short-term spending bills that last for several weeks in order to buy more time for negotiations. But they have already done that several times in recent months, and it’s uncertain whether they would take that step again.

Trump has readied a plan to declare a national emergency on the southern border, which he believes will allow him to redirect taxpayer money from other projects in order to build parts of a wall — without approval from Congress.

White House officials have said they would give the current negotiations a chance to succeed before moving forward with their plan, but they haven’t revealed an openness to delaying any longer.

The Monday afternoon meeting comes at a pivotal time. Trump plans to travel to El Paso for a rally Monday evening, and is expected to restate his case for tougher immigration rules. Republicans in Congress have tried to avoid Trump’s hard-line rhetoric during negotiations, but his support is crucial for a final deal.

The president on Monday attacked Democrats on Twitter, alleging Democrats are trying to create new protections for undocumented immigrants with criminal records.

“The Democrats do not want us to detain, or send back, criminal aliens! This is a brand new demand. Crazy!” he wrote.

Unlike with the fight over the border wall, which a majority of Americans oppose, Republicans say they are on strong political ground if the fight becomes centered on whether or not ICE has free rein to detain convicted or suspected criminals.

“The wall is unpopular. Enforcing the law is popular,” said Michael Steel, a GOP strategist and former top House aide. “This is particularly difficult terrain for Democrats to fight on. I think that most people want the laws enforced, and they expect that if illegal immigrants break the law, that they will be detained.”

A number of federal departments are only funded through Friday, and lawmakers are trying to agree on a long-term spending bill that would ensure these departments have money through September.

The negotiations have largely centered on spending and rules for the Department of Homeland Security. Trump has said rules must be overhauled to stop people from entering the U.S. illegally from Mexico. He wants a wall and other rule changes.

Negotiations had looked promising for days before unraveling on Saturday amid the fight between Democrats and Republicans over the number of unauthorized immigrants who can be detained by the U.S. Immigration and Customs Enforcement agency.

Both sides immediately began blaming each other for the impasse. The meeting Monday is an effort to broker a last-minute deal, though congressional aides and White House officials did not express optimism that an easy solution was within reach.

A partial shutdown could have a broad impact on the country. Not only would funding lapse for the Department of Homeland Security on Saturday, but it would hit a number of other agencies, including the Housing and Urban Development, Treasury, Agriculture and Interior departments, the Environmental Protection Agency, and the IRS.

During the last government shutdown, which began Dec. 22, 2018, and lasted 35 days, 800,000 federal employees went without pay. Many of them were still ordered to come into work, without pay, for the duration of the shutdown, in order to minimize the impact on the public.

At the beginning of talks, lawmakers looked for ways to avoid conflict over Trump’s demand that $5.7 billion in taxpayer money must be used to build parts of a wall along the Mexico border. Lawmakers were discussing sums between $1.3 billion and $2 billion, far short of Trump’s initial demands. The White House recently signaled to Republicans that it could accept smaller sums, because it believed it could legally reappropriate money from other accounts to build the wall. Moving money from one account to another could be challenged in court, but top White House officials have said they are prepared for legal challenges.

With lawmakers planning to continuing negotiating into the evening, they were cognizant that they didn’t have much time left to broker a deal.

“I wish we could have concluded it and I’d walk and say ‘Hallelujah,’ but we’re still having discussions,” Lowey said.

Washington Post writer Seung Min Kim contributed to this report.