WASHINGTON – Republican leaders, top Democrats and President Donald Trump are all claiming big wins in the $400 billion budget agreement signed into law Friday. But the push to pass the massive legislation underscored enduring divisions within both parties, and those rifts are likely to make the next fight over immigration even more challenging.In Washington’s latest display of governance by brinkmanship, the bipartisan accord bolstering military and domestic programs and deepening federal deficits crossed the finish line just before dawn — but not before the government shut down overnight.Passage left nerves frayed and Democrats with little leverage to force congressional action on their most high-profile priority: preventing deportation of hundreds of thousands of the young immigrants who arrived in the U.S. as children and remain here without permanent legal protection.Lawmakers rushed to limit the disruption and impact over the lapse in government funding, voting in the middle of the night to reopen agencies before workers were due to report to the office. It was the government’s second shutdown in three weeks, and most lawmakers were eager to avoid a big show of dysfunction in an election year.Sen. Rand Paul did not share the urgency. Late Thursday, the tea party leader and Kentucky Republican put the brakes on the bill in protest over Congress’ sudden willingness to embrace big deficit spending. Paul noted that he and many in his party railed against deficit when Democrats held the White House, but now seemed willing to look the other way with Republicans in control.He said he hoped his stand would teach conservatives “to not accept just anything because it comes from a GOP Congress.”Paul’s call clearly angered Republican leaders — Sen. John Cornyn called it “grossly irresponsible” — and it exposed a contradiction that may come to haunt Republicans as they try to fire up conservatives in midterm elections.The budget measure provides Pentagon spending increases sought by Trump and the GOP, more money for domestic agencies demanded by Democrats and $89 billion that both wanted for disaster relief. The two-year pact, which also continues the government’s authority to borrow money, postpones any possible federal default or likely shutdowns until after the November elections.But the 652-page budget bill says nothing about protection for the “Dreamer” immigrants. That omission largely explains why a quarter of Senate Democrats and two-thirds of House Democrats voted no, and why immigration now because the next battle. In January, after a three-day closure, Senate Democrats secured from GOP leaders the promise of a debate and vote on a deal to protect the younger immigrants from deportation.“Democrats have fought hard but, in the end, many opted to say yes to other priorities and leave Dreamers behind,” said Frank Sharry, executive director of the pro-immigration America’s Voice. He called that decision plus opposition by many Republicans “inhumane and indecent.”Senate Majority Leader Mitch McConnell, R-Ky., set next Monday as the start of a free-wheeling immigration battle, a debate he promised when Democrats agreed to vote to reopen the government last month. Ryan hasn’t scheduled House consideration, infuriating Democrats, but he said Friday, “We will focus on bringing that debate to this floor and finding a solution.”Democrats want to extend the Obama-era Deferred Action for Childhood Arrivals program, or DACA, which lets the immigrants temporarily live and work in the U.S. but that Trump would end March 5. The Democrats also want to make the immigrants eligible for citizenship or permanent residence.In exchange, Trump wants $25 billion to build his beloved, proposed U.S.-Mexico border wall and other barriers. He also wants reductions in legal immigration, including limiting the relatives whom legal residents can sponsor and eliminating a lottery that offers visas to residents of diverse countries.There’s no obvious compromise that could win the 60 votes from Republicans and Democrats needed to prevail in the Senate. The most promising outcome may be a narrow bill extending DACA protections for a year or so and providing some border security money for Trump.Whatever happens, this week’s budget battle dealt a clear immigration defeat to Democrats, who’d initially vowed to block spending bills until there was a deal to help the Dreamers. The setback left party members divided.No. 2 Senate Democratic leader Richard Durbin of Illinois, a leader in the immigration fight, said the budget pact “opens the door” for Senate votes on protecting the young immigrants. But Rep. Luis Gutierrez, D-Ill., said anyone supporting the spending measure was “colluding with this president and this administration to deport Dreamers.”Such disputes won’t help the party energize the Hispanic and liberal voters it will need as it tries capturing House and perhaps Senate control in November.Immigration divides Republicans, too.Sen. Jeff Flake of Arizona is preparing compromises to offer during his chamber’s upcoming debate and says his party will suffer in November if the issue isn’t addressed. No. 3 House GOP leader Steve Scalise of Louisiana says Republicans still disagree about “how to handle this number of people that Barack Obama encouraged to come in here illegally.”With the immigration fight looming, Congress voted overnight to finance the government through March 23, giving budget-writers time to craft detailed legislation funding agencies through the rest of this fiscal year.The House voted 240-186 to approve the bill just before dawn Eastern time, hours after the Senate approved the measure 71-28, with some of Congress’ most conservative and liberal lawmakers voting no. Trump signed it as business hours began, and he couldn’t resist a dig.“This Bill is a BIG VICTORY for our Military, but much waste in order to get Dem votes,” he tweeted. “Fortunately, DACA not included in this Bill, negotiations to start now!”___Associated Press writers Matthew Daly and Andrew Taylor contributed to this report.__This story corrects that about two-thirds, not one-third, of House Democrats voted against the bill.