The Republican-led Congress is set to vote Thursday on a two-year budget deal that would include massive increases in military and domestic spending programs, reflecting an ideological shift for a party whose leaders long preached fiscal conservatism but have now embraced big spending.

If the plan wins passage, it would quell months of squabbling between the parties with another big addition to the federal deficit, ending the need for repeated short-term agreements that led to frequent brinkmanship and a government shutdown.

The accord would deliver the defense funding boost wanted by President Trump and Republican lawmakers alongside an increase in domestic programs sought by Democrats, as well as tens of billions of dollars for disaster victims.

Trump backed the deal Wednesday, saying in a tweet that it would give Defense Secretary Jim Mattis “what he needs to keep America Great” and calling on lawmakers of both parties to “support our troops and support this Bill!”

The Senate is expected to vote first on the plan, clearing it Thursday afternoon or evening — giving the House just hours to act before a midnight deadline for a government shutdown.

But the deal offered another reminder that GOP lawmakers, many of whom were elected on a promise to shrink government and curb spending, have abandoned those pledges after gaining power and facing the reality of governing and delivering on competing political priorities. The tax-cut law they passed in December is also expected to add to the federal deficit.

Several Republicans, citing their continued belief in the virtue of limiting government spending, on Wednesday voiced their objections to the plan.

“This spending bill is a debt junkie’s dream,” said Rep. Mo Brooks (R-Ala.), warning that it would set up trillion-dollar-a-year deficits. “I’m not only a no; I’m a hell, no.”

Sen. Bob Corker (R-Tenn.) noted the deal would deliver more military funding than Trump requested in his 2018 budget proposal. “I’m all for supporting our military, and I want to make sure they’re funded properly,” he said. “It’s very difficult to have that big of an increase in one year and then be able to use it wisely.”

The budget agreement would increase what’s called discretionary spending — areas such as scientific research, education, roads and health care that are funded year to year through congressional appropriations — by 21 percent over existing budget caps.

Those caps were put in place after 2011 budget talks broke down between President Barack Obama and GOP congressional leaders.

Bipartisan deals raised the caps in 2013 and 2015, and the new agreement is the first to be struck under unified Republican control of the White House and both chambers of Congress.

The budget agreement was unveiled on the Senate floor Wednesday in a moment of harmony between top party leaders.

“I hope we can build on this bipartisan momentum and make 2018 a year of significant achievement for Congress, for our constituents and for the country we all love,” Senate Majority Leader Mitch McConnell (R-Ky.) said, while Minority Leader Charles E. Schumer (D-N.Y.) called it “the first real sprout of bipartisanship” in the Trump era.

Such amity was not on display in the House. Democrats remained disgruntled that the agreement did not include protections for young undocumented immigrants who were brought to the United States as children and are now at risk for deportation after Trump moved to cancel the Obama-era Deferred Action for Childhood Arrivals program.

House Minority Leader Nancy Pelosi (D-Calif.) said Wednesday that she and “a large number” of fellow Democrats would oppose the deal unless she is guaranteed a vote on immigration legislation.

She delivered the ultimatum at the top of an eight-hour stretch of remarks that broke a modern record for the longest House floor speech.

Meanwhile, House Speaker Paul D. Ryan (R-Wis.) presented the deal behind closed doors to the Republican rank-and-file, who were largely eager to secure the defense funding boost but wary of reneging on their long-standing promises to rein in spending.

Rep. Tom McClintock (R-Calif.), a conservative member of the House Budget Committee, said he had not decided how he would vote on the budget plan. “But there’s no blinking at the fact that, having reduced taxes, we now have to restrain spending,” he said. “I’m hoping when I take a closer look at it, I’ll see it, but I don’t at the moment.”

Inside the meeting, Ryan told members that the domestic spending would be focused on areas that have broad bipartisan support, such as medical research, infrastructure and veterans’ health care — a pitch that appeared to win over some members.

“If we’re going to have some domestic spending, let’s spend it on things that actually matter instead of things that are wasteful,” said Rep. Steve Russell (R-Okla.). “None of it is pleasant because of the dollar amounts we’re talking about. But at least it’s money spent finally on some of the right areas.”

But it appeared unlikely the bill would be able to pass the House solely with Republican votes.

The chairman of the hard-right House Freedom Caucus, Rep. Mark Meadows (R-N.C.), said all but “a couple” of the group’s three dozen members would oppose it on fiscal grounds.

Influential conservative organizations such as the Heritage Foundation and the Club for Growth railed against the spending boost. Leaders of advocacy groups funded by brothers Charles and David Koch said in a statement that the deal was “a betrayal of American taxpayers and a display of the absolute unwillingness of members of Congress to adhere to any sort of responsible budgeting behavior.”

According to outlines of the budget plan circulated by congressional aides, existing spending caps would be raised by a combined $296 billion through 2019. The agreement includes an additional $160 billion in uncapped funding for overseas military and State Department operations, and about $90 billion more would be spent on disaster aid for victims of recent hurricanes and wildfires.

The bill also includes a provision suspending the federal debt limit until March 1 of next year — after November’s midterm elections — typically a politically difficult vote for Republicans.

Some of the funding is reserved for programs favored by lawmakers of both parties: research conducted by the National Institutes of Health, for instance, as well as transportation and water infrastructure. Also included are extensions of tax breaks that could add billions of dollars more to the cost of the bill.

The Children’s Health Insurance Program would be extended through 2028, and the federal fund for community health centers would see a two-year extension. The bill also abolishes the Independent Payment Advisory Board, a body established in the 2010 Affordable Care Act with the power to reduce the payments Medicare makes to health providers.

The legislation setting out the deal is expected to contain yet another deadline, March 23, giving congressional appropriators time to negotiate the fine details of funding agencies for the remainder of 2018.