Democrats believe they have set the stage to block President Donald Trump's legislative priorities for years to come by winning major concessions in a spending bill to keep the government open.

House Minority Leader Nancy Pelosi, D-California, and Senate Minority Leader Charles Schumer, D-New York, secured nearly $5 billion in new domestic spending by exploiting disagreements between Trump and GOP lawmakers over spending priorities.

Democrats' lopsided victory on the five-month deal, which is likely to be approved this week, means it will be very difficult - if not impossible - for the GOP to exert its will in future budget negotiations, including when it comes to Trump's 2018 budget blueprint.

That's because Republicans are hopelessly divided over how much to spend on government programmes, with a small but vocal minority unwilling to support such measures at all. That has forced Republicans to work with Democrats to avoid politically damaging government shutdowns.

And that means Democrats are in the driver's seat when it comes to budget battles, even with Trump in the White House.

“I think we had a strategy and it worked,” Schumer said in an interview with The Washington Post. “Democrats and Republicans in the House and Senate were closer to one another than Republicans were to Donald Trump.”

The extra money for domestic programmes will now be that much harder to strip out of future budgets, and Trump's priorities, such as money for a wall along the border with Mexico, could be more difficult to include.

“We can't pass anything without them,” Sen. John Cornyn, R-Texas, a top deputy to Senate Majority Leader Mitch McConnell, R-Kentucky, said of Democrats recently.

Hill Republicans remain sceptical of, if not openly hostile to, many of Trump's plans - including the wall and proposals to slash millions from programmes such as the National Institutes of Health and foreign aid.

In addition to the $5 billion in domestic spending, the bipartisan agreement released early Monday morning is packed with Democratic priorities, such as protection for funding for Planned Parenthood, a permanent extension of health care for coal miners and money to help Puerto Rico make up a projected shortfall in Medicaid.

Pelosi celebrated in a letter to House Democrats on Monday, saying that the measure “reflects significant progress defeating dangerous Republican riders and securing key victories for Democratic priorities.”

“In a defeat for President Trump, the [deal] does not fund the immoral and unwise border wall or create a cruel new deportation force,” Pelosi wrote.

Democrats are counting on GOP infighting over spending to guarantee that those parts of Trump's agenda won't be funded in the next spending deal, either.

Republicans could try to craft a new agreement to govern spending after 30 September, complete with domestic cuts and funding for Trump's wall. But such a measure would probably fail in the Senate, where Republicans hold a slim 52 to 48 majority, short of the 60 votes needed to pass most legislation.

Or, as they have often done in the past, lawmakers could abandon broad ambitions and decide to simply extend current spending levels, locking in Democrats' policy victories for another year.

Republicans in Congress were unusually quiet about the deal. But White House aides sought to put a positive spin on areas where Trump fell short, including the wall.

“I think it's great that the Democrats like the bill,” White House budget director Mick Mulvaney told reporters during a Monday briefing. “We thought it was a really good deal for this administration as well.”

He said the White House agreed not to “push for bricks and mortar for the wall” but to instead focus on fixing existing fencing and installing new lights and sensors on the border. Mulvaney was one of several top Trump aides who insisted that plans for wall construction would soon begin anew.

“Make no mistake, the wall is going to be built,” White House press secretary Sean Spicer said at his daily briefing, adding that there is plenty the administration can do to plan for construction between now and when Trump gets his next opportunity to secure funding.

But wall construction was one of several areas where GOP lawmakers' decision to punt this week could doom the president's priorities for the future.

Language in the deal explicitly prohibits money for border security from being used for building the wall, for instance. Trump has said he plans to revive the push this fall.

Both Spicer and Vice President Mike Pence said they considered the $21 billion in additional military spending - $15 billion from an off-budget war fund and $6 billion in budget increases - to be their biggest victory, even though it was about two-thirds of what Trump had sought.

Additionally, there were no reductions in funding to “sanctuary cities”; a federal judge said last week that the Justice Department needed congressional approval to follow through on its threats to cut money for such places, which don't comply with federal immigration authorities. Nor was there money to fulfill Trump's promise of a hiring spree to build a deportation force at Immigration and Customs Enforcement.

Trump also agreed to continue paying Affordable Care Act subsidies after his aides threatened last week to use that issue as a bargaining chip. The subsidies, which go to insurance companies, reduce out-of-pocket expenses for low-income people who get coverage under President Barack Obama's signature domestic initiative.

Pence celebrated the deal Monday, saying Trump himself played a key role in reaching it.

“I think this morning's announcement about reaching a bipartisan deal on the budget says that the American people can be encouraged that Washington is working again, thanks to the strong leadership of President Donald Trump,” Pence said on CBS This Morning. “Thanks to his direct engagement with members of Congress, we're seeing real progress.”

But Trump's involvement was seen by many congressional aides as unhelpful to reaching a deal in the bipartisan talks. Negotiators were nearing an agreement on the spending portions and were ready to move on to unrelated policy measures when Mulvaney publicly renewed demands that the bill include money for a wall along the southern border.

Mulvaney's demand was out of sync with GOP leaders, who long ago said they wouldn't seek any funding for a wall or cuts to sanctuary city funding.

It also came weeks after Schumer personally told Mulvaney that the best way to avoid a government shutdown would be for the White House to stay out of budget negotiations and let Congress work its will, according to two people with direct knowledge of the conversation. Mulvaney nodded, they said, and proceeded to make the demand anyway.

His office did not return a request for comment on the subject.

Democrats also believe that the White House created a public relations crisis when Trump threatened to end payments for the subsidies, which help cover roughly 6 million people under Obamacare. The president later withdrew the threat, and the White House decided to continue the payments, in hopes of reducing the number of sticking points in the spending bill.

But the president put a spotlight on the issue just as public polls were starting to show overwhelming support for the subsidies and the ACA in general. Democrats were thrilled to add the attack on the health-care law to the mix in the spending fight because they thought the public would blame Republicans if a deal couldn't be reached to fund the government, according to several Democratic aides familiar with the strategy.

Donald Trump's first 100 days: in cartoons Show all 33 1 /33 Donald Trump's first 100 days: in cartoons Donald Trump's first 100 days: in cartoons Donald Trump's first 100 days in office were marred by a string of scandals, many of which caught the eye of the Independent's cartoonists Donald Trump's first 100 days: in cartoons Trump's first 100 days have seen him aggressively ramp up tensions with his nuclear rivals in North Korea Donald Trump's first 100 days: in cartoons Mr Trump has warned of a "major, major conflict" with the pariah nation lead by Kim Jong Un Donald Trump's first 100 days: in cartoons Mr Trump dropped the "mother of all bombs" on alleged ISIS-linked militants in Afghanistan, amid an escalation of US military intervention around the globe Donald Trump's first 100 days: in cartoons Mr Trump has been accused of falling short of the standards set by his predecessors in the Oval Office, including Franklin D Roosevelt Donald Trump's first 100 days: in cartoons The tycoon's ascension to the White House came at a time when the balance of power is shifting away from Western nations like those in the G7 group Donald Trump's first 100 days: in cartoons Western politicians, including the British Conservative party, have been accused of falling in line behind Mr Trump's proposals Donald Trump's first 100 days: in cartoons Brexit is seen to have weakened Britain, reducing still further any political will to resist American leadership Donald Trump's first 100 days: in cartoons Mr Trump's leadership has been marked by sudden and unexpected shifts in global policy Donald Trump's first 100 days: in cartoons Trump's controversial missile strike on Syria, which killed several citizens, was seen by some analysts as an attempt to distract from his policy elsewhere Donald Trump's first 100 days: in cartoons The President has also spent a large majority of his weekends golfing, rather than attending to matters of state Donald Trump's first 100 days: in cartoons Though free of gaffes, a visit from Chinese president Xi Jinping spotlighted trade tensions between the two states Donald Trump's first 100 days: in cartoons One major and unexpected setback came when Mr Trump's Healthcare Bill was struck down by members of his own party Donald Trump's first 100 days: in cartoons Mr Trump has been a figure of fun in the media, with his approval at record lows Donald Trump's first 100 days: in cartoons A string of revelations about Mr Trump's financial indiscretions did not mar his surge to the White House Donald Trump's first 100 days: in cartoons Outgoing President Barack Obama was accused of wiretapping Trump Tower by his successor in America's highest office Donald Trump's first 100 days: in cartoons The alleged involvement of Russian intelligence operatives in securing Mr Trump the presidency prompted harsh criticism Donald Trump's first 100 days: in cartoons The explosive resignation of Security Adviser Michael Flynn, who lied about his links to the Russian ambassador, was just one scandal to hit the President Donald Trump's first 100 days: in cartoons Many scandals, such as the accusation Barack Obama was implicated in phone-hacking, first broke on Mr Trump's Twitter feed Donald Trump's first 100 days: in cartoons Donald Trump's election provoked mass protests in the UK, with millions signing a petition to ban him from the country Donald Trump's first 100 days: in cartoons Donald Trump cited a non-existent terror attack in Sweden during a campaign rally Donald Trump's first 100 days: in cartoons Donald Trump stands accused of stoking regional tensions in Eastern Asia Donald Trump's first 100 days: in cartoons North Korea has launched a number of failed nuclear tests since Mr Trump took power Donald Trump's first 100 days: in cartoons Theresa May formally rejected the petition calling for Mr Trump to be banned from the UK Donald Trump's first 100 days: in cartoons When Mr Trump's initial so-called Muslim ban was struck down by a federal justice, the President mocked the 69-year-old as a "ridiculous", "so-called judge" Donald Trump's first 100 days: in cartoons A week after his inauguration, Theresa May met with Mr Trump at the White House Donald Trump's first 100 days: in cartoons Donald Trump's first days in office were marked by a hasty attempt to follow through on many of his campaign promises, including the so-called Muslim ban Donald Trump's first 100 days: in cartoons Donald Trump's decision to ban citizens of many majority-Muslim countries from the US sparked mass protests Donald Trump's first 100 days: in cartoons Revelations about Donald Trump's sexual improprieties were not enough to keep him from being elected President Donald Trump's first 100 days: in cartoons British PM Theresa May was criticised by many in the press for cosying up to the new President Donald Trump's first 100 days: in cartoons One of Mr Trump's top aides, Kelly Anne Conway, was mocked for describing mistruths as "alternative facts" Donald Trump's first 100 days: in cartoons British PM Theresa May was quick to demonstrate that her political aims did not hugely differ from Mr Trump's Donald Trump's first 100 days: in cartoons Donald Trump's inauguration, on 20 January 2017, sparked protests both at home and abroad

Now, Democrats believe, the public will also blame the GOP if the subsidies disappear, a win-win for them.

“We had the upper hand, and we maximised that leverage,” Schumer said, predicting that the fight would go on. “We figured out our bottom line first, and we made it clear that we had the upper hand because the shutdown would fall on their shoulders.”