The White House and Senate leaders are moving closer to a deal to avert a government shutdown but are seeking to resolve final sticking points in eleventh-hour negotiations ahead of Friday’s deadline, according to several sources familiar with the talks.

The sources indicated that the White House was moving closer to the Democrats’ demands to split funding from the Department of Homeland Security from a larger funding package in order to give them time to negotiate new policy measures on the deployment of ICE agents across the country.

The deal in the works would provide funding for the rest of the agencies in the package through the end of September — including the departments of Defense, Labor, State, Transportation and Health and Human Services. But it would only temporarily extend funding for DHS. That would allow time for the two sides to negotiate over ICE, after Senate Minority Leader Chuck Schumer laid out a list of demands that he says must be included in final legislation.

The two sides are still trying to sort out the timeline for extending funding for DHS, the sources said, underscoring that a deal has not yet been reached.

But the fast-moving talks are a clear sign that President Donald Trump and GOP leaders recognize that they need to respond to the public outcry over ICE agents’ harsh tactics following the deadly shootings of two US citizens in Minneapolis this month. Plus, it’s a sign that Trump is eager to avoid the second government shutdown of his second term, after the 43-day shutdown from last fall left him upset about the fallout.

CNN has reached out to the White House for comment.

Earlier Wednesday, Schumer laid out a list of new restraints on immigration enforcement as a condition for Democratic support, including to restrict roving patrols, tighten parameters around warrants for searches and arrests, toughen use-of-force policies and require ICE agents to wear body cameras and remove their masks. Democrats, who have enough votes to sustain a filibuster in the 53-47 GOP-led Senate, say such changes must be in legislation — and that promises of executive action are not enough.

As Democrats and Republicans negotiated Wednesday on the Hill, the risk of a shutdown appeared to skyrocket earlier in the day.

Behind the scenes, several of Schumer’s Democrats rebuffed efforts by the White House to privately discuss off-ramps for a shutdown, insisting that Republicans must come to the table instead of trying to peel off centrist Democrats like the last shutdown.

Even confronted with the prospect of a shutdown of three-quarters of the government starting Saturday, many Democrats were unwavering – buoyed by a belief that the country’s patience for the Trump administration’s aggressive immigration enforcement tactics have run out.

“I am just so sick of them ignoring it all because Donald Trump might give them a spanking,” Sen. Jacky Rosen, a Democrat from Nevada, said.

There is little time to reach a deal that can pass both chambers ahead of the Friday deadline at 11:59 p.m.

CNN’s Lauren Fox, Sarah Ferris and Alayna Treene contributed to this report.

This story has been updated with additional details.