By Andrew Taylor, Associated Press

WASHINGTON — Senate leaders brokered a long-sought budget agreement Wednesday that would shower the Pentagon and domestic programs with an extra $300 billion over the next two years. But both Democratic liberals and GOP tea party forces swung against the plan, raising questions about its chances just a day before the latest government shutdown deadline.

The measure was a win for Republican allies of the Pentagon and for Democrats seeking more for infrastructure projects and combatting opioid abuse. But it represented a bitter defeat for many liberal Democrats who sought to use the party's leverage on the budget to resolve the plight of immigrant "Dreamers" who face deportation after being brought to the U.S. illegally as children. The deal does not address immigration.

Senate leaders hope to approve the measure Thursday and send it to the House for a confirming vote before the government begins to shut down Thursday at midnight. But hurdles remain to avert the second shutdown in a month.

While Senate Democrats celebrated the moment of rare bipartisanship — Minority Leader Chuck Schumer called it a "genuine breakthrough" — progressives and activists blasted them for leaving immigrants in legislative limbo. Top House Democrat Nancy Pelosi of California, herself a key architect of the budget plan, announced her opposition Wednesday morning and mounted a remarkable daylong speech on the House floor, trying to force GOP leaders in the House to promise a later vote on legislation to protect the younger immigrants.

"Let Congress work its will," Pelosi said, before holding the floor for more than eight hours without a break. "What are you afraid of?"

The White House backed the deal — despite President Donald Trump's outburst a day earlier that he'd welcome a government shutdown if Democrats didn't accept his immigration-limiting proposals.

Trump himself tweeted that the agreement "is so important for our great Military," and he urged both Republicans and Democrats to support it.

But the plan faced criticism from deficit hawks in his own party.

Some tea party Republicans shredded the measure as a budget-buster. Combined with the party's December tax cut bill, the burst in military and other spending would put the GOP-controlled government on track for the first $1 trillion-plus deficits since President Barack Obama's first term. That's when Congress passed massive stimulus legislation to try to stabilize a down-spiraling economy.

"It's too much," said Rep. Scott Perry, R-Pa., a fiscal hawk.

House Speaker Paul Ryan, R-Wis., however, backed the agreement and was hoping to cobble together a coalition of moderate Democrats and Republicans to push it through.

Despite the 77-year-old Pelosi's public talkathon, she was not pressuring the party's rank-and-file to oppose the measure, Democrats said. The deal contains far more money demanded by Democrats than had seemed possible only weeks ago, including $90 billion in disaster aid for Florida and Texas. Some other veteran Democrats — some of whom said holding the budget deal hostage to action on Dreamer immigrants had already proven to be a failed strategy — appeared more likely to support the agreement than junior progressives elected in recent years.

The 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 core of the agreement would shatter tight "caps" on defense and domestic programs funded by Congress each year. They are a hangover from a failed 2011 budget agreement and have led to military readiness problems and caused hardship at domestic agencies such as the Environmental Protection Agency and the IRS.

The agreement would give the Pentagon an $80 billion increase for the current budget year for core defense programs, a 14 percent increase over current limits and $26 billion more than Trump's budget request. Nondefense programs would receive about $60 billion over current levels. Those figures would be slightly increased for the 2019 budget year beginning Oct. 1.

"For the first time in years, our armed forces will have more of the resources they need to keep America safe," said Majority Leader Mitch McConnell, R-Ky. "It will help us serve the veterans who have bravely served us. And it will ensure funding for important efforts such as disaster relief, infrastructure and building on our work to fight opioid abuse and drug addiction."

The $90 billion in disaster aid would bring the total appropriated in the wake of last year's hurricane season to almost $140 billion.

The agreement would increase the government's borrowing cap to prevent a first-ever default on U.S. obligations that looms in just a few weeks. The debt limit would be suspended through March of 2019, Sanders said, putting the next vote on it safely past this year's midterm elections.

The House Tuesday passed legislation to keep the government running through March 23, marrying the stopgap spending measure with a $659 billion Pentagon spending plan, but the Senate plan would rewrite that measure.

Pelosi said the House should push into immigration legislation and noted that Senate Republicans have slated a debate on the politically freighted subject starting next week. At issue is legislation to address the dilemma of immigrants left vulnerable by Trump's move to end Obama's Deferred Action for Childhood Arrivals program, or DACA.

Rep. Nanette Barragan, D-Calif., a member of the Congressional Hispanic Caucus, said the Latino community thinks Senate Democratic leaders have "turned their back."

And a frustrated Angel Padilla, policy director for the liberal group Indivisible, said of the Democratic leaders: "What are they thinking? They're giving up their leverage. ... All of these votes will matter come November."

Dreamers and supporters mounted a peaceful protest in a Senate office building.

Schumer said the plan would contain $20 billion dedicated to infrastructure such as highways and bridge construction and repair, water and wastewater projects, and rural broadband.

There's also $4 billion for construction for veterans hospitals and clinics, $6 billion to fight the opioid crisis and fund mental health programs and $4 billion for college aid.

___

Associated Press reporters Alan Fram, Kevin Freking, Luis Alonso Lugo and Jill Colvin in Washington and Steve Peoples in New York contributed to this report.

__

This story corrects 'filibuster' to 'speech' in the 5th paragraph. Pelosi's speech did not fit the technical definition of a filibuster.