WASHINGTON (AP) — Senate negotiators worked to finalize a long-term federal budget deal Wednesday that would avert a looming government shutdown, but the House's top Democrat swung out against it, jeopardizing its chances.

House Minority Leader Nancy Pelosi of California announced she would oppose the measure unless the chamber's GOP leaders promised a vote on legislation to protect "Dreamer" immigrants who face deportation after being brought to the U.S. illegally as children.

Pelosi took to the House floor, promising to speak for hours, and said she would oppose that almost-completed budget pact even though it would boost funding for many domestic priorities favored by Democrats. She declared the agreement "does not have my support, nor does it have the support of a large number of members of our caucus."

Pelosi said the House should debate immigration legislation and noted that Senate Republicans have slated a debate on the politically freighted subject starting next week.

"Let Congress work its will," Pelosi said. "What are you afraid of?"

A government shutdown could come at midnight Thursday. The House on Tuesday passed legislation to keep the government running through March 23, marrying a stopgap spending measure with a $659 billion Pentagon spending plan, but that measure is likely to be rewritten in the Senate.

Chances of a repeat of last month's shutdown had appeared to be fading as prospects of a budget pact grew, but Pelosi's opposition could throw a monkey wrench into the plan. And the problem wasn't just with Democrats.

On the right, Rep. Mark Meadows, R-N.C., leader of the hard-line House Freedom Caucus, also said he opposes the emerging bipartisan deal, which could be unveiled Wednesday.

"I'm afraid the numbers will get so high and the debt ceiling will be added and it will be a Christmas tree of spending — that a lot of votes will be bought," he said on MSNBC. Meadows' group backs big defense increases but opposes boosting domestic spending.

The deal had been picking up steam even as the president appeared to be readying for a standoff.

"I'd love to see a shutdown if we can't get this stuff taken care of," Trump declared Tuesday.

Trump's comments were strikingly disconnected from the apparent progress on Capitol Hill, where the House passed a short-term spending measure Tuesday night and Senate leaders were closing in on the larger, long-term pact. The broader agreement would award whopping spending increases to both the Pentagon and domestic federal programs, as well as approve overdue disaster relief money and, perhaps, crucial legislation to increase the government's borrowing limit and avoid possible default.

Senate Democratic leaders have dropped their strategy of using the funding fight to extract concessions on immigration, specifically on seeking extended protections for the "Dreamer" immigrants who have lived in the country illegally since they were children. Instead, Senate Minority Leader Chuck Schumer, D-N.Y., prepared to cut a deal that would reap tens of billions of dollars for other priorities — including combatting opioids — while taking their chances on solving the immigration impasse later.

Tuesday night's 245-182 House vote, mostly along party lines, set the machinery in motion.

The budget negotiations, conducted chiefly by the Senate's top leaders, Schumer and Majority Leader Mitch McConnell, R-Ky., have intensified in recent days.

"I think we're on the way to getting an agreement and getting it very soon," McConnell said Tuesday.

Prospects for dealing with immigration, however, were fuzzy as ever. The Senate is slated next week to begin a debate to address the dilemma of immigrants left vulnerable after Trump cut off former President Barack Obama's Deferred Action for Childhood Arrivals program, or DACA.

Weeks of bargaining have left the two parties divided over how to extend protections for such immigrants. Trump has given lawmakers until March 5 to extend DACA, though a court ruling is temporarily keeping the program running.

On the budget, GOP defense hawks were prevailing over the party's depleted ranks of deficit hawks, championing major new spending on military programs. Democrats, meanwhile, leveraged their influence to increase spending for domestic priorities.

The result could be the return of trillion-dollar deficits for the first time since Obama's first term.

The prospective longer-term budget agreement would give both the Pentagon and domestic agencies relief from a budget freeze that lawmakers say threatens military readiness and training as well as domestic priorities such as combating opioid abuse and repairing the troubled health care system for veterans.

The temporary funding measure would also reauthorize funding for community health centers, which enjoy widespread bipartisan support.

Aides in both parties said the budget measure may also contain a provision to raise the government's $20.5 trillion borrowing limit. Legislation to increase the debt ceiling is always a headache, especially for House GOP leaders whose rank and file have used past votes to register objections to deficit spending.

Another likely addition is more than $80 billion in long-overdue hurricane relief for Texas, Florida and Puerto Rico, a top priority of both parties.

It's clear that Senate Democrats have no appetite for another government shutdown. Their unity splintered during last month's three-day closure.

Pelosi, however, took the temperature of House Democrats at a Wednesday morning meeting, and emerged to announce her opposition to the budget plan that lacks a promise for a floor debate on immigration.

"I just can't explain to the Dreamers or to my colleagues why we should be second-class members of Congress in this House, without a commitment from the speaker that Mitch McConnell gave to the senators, that then there would be a vote on the floor, to let Congress work its will. What are you afraid of?"