House Republican leaders won a key assurance from conservative Freedom Caucus to back a short-term measure to fund the government, as President Trump used Twitter to try to rally support for it.

But the bill could still blow up in the Senate, which could lead to a feared government shutdown on Friday unless Republicans can bring over Democratic support.

President Trump lent his voice to the debate on Twitter Thursday night, urging support for a measure he was questioning just hours earlier.

'House of Representatives needs to pass Government Funding Bill tonight. So important for our country - our Military needs it!' Trump wrote.

'I think we have the votes to make sure [Democrats] don't shut down the government as they've threatened to do,' said Oklahoma GOP Rep. Tom Cole on the House floor, complaining about Democratic demands of funding for immigration protections for DACA recipients.

In a pointed visit to the Pentagon on Thursday, President Donald Trump sounded the alarm on a government shutdown

A key moment came when House leaders won the support from Rep. Mark Meadows of the Freedom Caucus with the assurance of a separate vote on military readiness.

'Obviously, I would be recommending to our caucus, based on what I just heard, that we support the president in this particular initiative," Meadows said, the Hill reported.

But the possibility of a shutdown remained a live option. Senate Democrats say they have the votes to stop the bill was taking up, Politico reported.

In a pointed visit to the Pentagon on Thursday, President Donald Trump sounded the alarm on a government shutdown.

A shutdown would wreak havoc on the military, he claimed from the steps of the military hub, and it can only be prevented if Democrats end their attempt to score political points on him.

'For any reasons it shuts down, the worst thing is what happens to our military,' the commander-in-chief said. 'The group that loses big would be the military, and we're never letting our military lose at any point.

SCROLL DOWN FOR VIDEO

As the vote neared the leader of an influential band of conservatives said his group, the House Freedom Caucus, would not vote for the bill unless the troops receive a long-term pay raise.

'I can say that if there is not any Democratic support, currently there is not enough votes to get to 218,' said Rep. Mark Meadows, the Freedom Caucus chairman, on CNN.

A vote on the legislation was expected to happen still on Thursday evening, Meadows said, whether Republicans had the votes or not to pass it in the House.

The Senate must also vote on it before end of day tomorrow and win over at least 10 if not more Democrats for a shutdown to be averted.

Trump claimed in his remarks today before a meeting with military leaders that was supposedly part of a nuclear posture review that Democrats refusing to vote for the bill are acting out because they are trying to undercut the success of his tax reform legislation.

'You see what's happening with respect to jobs. You see what happened yesterday -- Apple, and now it was just announced that they're giving each employee a lot of money,' he said. 'So our tax cuts and our tax reform has turned out to be far greater than anybody ever anticipated, and I'm sure the Democrats would like to blunt that by shutting down government.'

Earlier in the day it was Trump who threatened legislation that could prevent a shutdown when he tweeted his dissatisfaction with a provision that renews the government's health insurance program for children for a period of six years.

House Speaker Paul Ryan then argued at a news conference, where he hammered away at Democrats, that Trump supports the legislation the way it is.

The White House also went into damage control mode, sending out another statement in support of the House bill.

Meadows told CNN on Thursday evening that Trump is supportive of the CHIP extension, but he's frustrated that it wasn't enough for Democrats to throw their support behind the spending bill.

'To not get any Democratic support,' Meadows said, 'was a disappointment for the president.'

At the Pentagon, Trump railed against the opposing party, this time for holding a longer-term bill that would do away with government-mandated budget caps, freeing up the military to spend all of the money it was authorized to spend by Congress last year.

'Our military has to be the best in the world, by far. And as you know, it's been depleted over the last long period of time,' he said. 'And when we finish, there won't be anything like it. We need that now almost more than at any time in the past.'

Trump said then that a shutdown 'could happen' and 'it's up to the Democrats.'

President Donald Trump talks to reporters after arriving at the Pentagon on Thursday. He and Vice President Mike Pence (back center) were met outside by Defense Secretary Jim Mattis

Trump claimed in his remarks before a meeting with military leaders that was supposedly part of a nuclear posture review that Democrats are acting out because they are trying to blunt the success of his tax deal

Ryan insisted soon after at a news conference that Republicans could pass a bill on their own. That did not keep him from beating up Democrats, though, for rejecting a Republican olive branch to extend the Children's Health Insurance Program for another six years.

'I have confidence we'll pass this because I think members understand why on earth would we want to have a government shutdown, hurt the military, and by the way the sequester then on the military starts kicking in due time. That is not in anyone's interest,' he said. 'And so why we would want to feed the idea that we should use our troops as a bargaining chip in an unrelated deal.'

Making a reference to Democratic plans to boycott the bill because it does not include a provision to save the Dreamers, Ryan said: 'I think it is unconscionable that Democrats would walk away from CHIP, from funding our military, for something that is not a deadline.'

Ryan said he feels like the GOP 'is in a good place' to pass the bill but he believes Democrats should join Republicans in voting for it.

White House deputy press secretary Raj Shah also told reporters that Trump, who often spends his weekends at his Palm Beach estate in Florida, expects to sign a continuing resolution before midnight rolls around on Friday.

Shah said in a statement that attempted to end confusion on Trump's position on the spending resolution that the president would prefer Congress pass a deal that goes beyond February but he will accept another continuing resolution in order to prevent a shutdown.

'The President supports the continuing resolution introduced in the House,' Shah said. 'Congress needs to do its job and provide full funding of our troops and military with a two year budget caps deal. However, as the deal is negotiated, the President wants to ensure our military and national security are funded. He will not let it be held hostage by Democrats.'

At the Pentagon, Trump turned his visit into an opportunity to rail against Democrats holding a longer-term bill that would do away with government-mandated budget caps, freeing up the military to spend all of the money it was authorized to spend by Congress last year

Trump said in a Thursday morning tweet that he does not want the spending plan under development in the House to include a six-year reauthorization of CHIP

Not only does the position put him in conflict with his own White House, it threatens to derail his party's efforts to pass a stop-gap bill once again

Just as Republican leaders in Congress were rounding up the votes on Thursday needed to pass another temporary extension in government funding and prevent a shutdown at week's end, President Trump undercut their strategy with a demand that CHIP be axed from the bill.

Trump said in a Thursday morning tweet that he does not want the spending plan under development in the House to include a six-year reauthorization of CHIP.

'CHIP should be part of a long term solution, not a 30 Day, or short term, extension!' he said.

Not only did the position put him in conflict with his own White House, it threatens to derail his party's efforts to pass a stop-gap bill once again.

For months, the Republican-controlled Congress has been struggling to reach an agreement to fund the government, which is currently operating on its third continuing resolution since the 2018 fiscal year began on Oct. 1.

Democrats have insisted that a long-term spending bill include protections for 'Dreamers' - young adults brought to the country illegally as children who were protected from deportation by former President Barack Obama's Deferred Action for Childhood Arrivals, or DACA, program.

But bipartisan congressional negotiations with the White House faltered last week, prompting Republican leaders to begin pushing for the passage of a stopgap measure to fund the government through Feb. 16.

Already, it was unclear whether the House Republicans would get enough votes to pass the measure in that chamber on Thursday morning.

Then, President Trump then offered his two cents on Twitter.

'A government shutdown will be devastating to our military...something the Dems care very little about!' Trump said in a second tweet that blamed the opposing party for the crisis.

Yesterday, the White House said it supported the passage of a short-term measure to fund the government, although it wasn't ideal.

'We do support the short-term CR,' White House spokeswoman Sarah Sanders told reporters, referring to the so-called continuing resolution.

'Let's make a budget deal by Friday and let's come back to work aggressively on Monday and make a deal on DACA and responsible immigration reform,' Sanders added.

A statement of administration policy distributed by the White House's Office of Management and Budget shortly after explicitly backed the provision reauthorizing CHIP for half a decade.

'This legislation funds the Federal Government at current spending levels through February 16, providing more time for the Congress and the Administration to reach a longer-term funding agreement,' the statement said. 'The Administration supports the bill’s multiyear funding extension of the Children’s Health Insurance Program (CHIP).'

It was not clear on Thursday whether Trump understood that his administration had backed the renewal less than 24 hours before.

Republicans hold a slim 51-49 majority in the Senate and most legislation, including spending bills or an immigration deal, will require 60 votes for passage.

Senate Majority Leader Mitch McConnell said the Senate would take up the short-term funding measure as soon as the House approves it.

On Wednesday, Senate Democratic leader Chuck Schumer said there was 'revulsion' among his colleagues for the stopgap proposal in the House and that an 'overwhelming number' would not support it, however.

At least two Republicans, Senator Lindsey Graham, who is involved in the immigration negotiations, and Senator Rand Paul, have also said they would not vote for a short-term funding measure.

Republicans in the House might not have the votes in the House to pass a short-term fix in the first place, given that members of the conservative House Freedom Caucus would prefer additional defense funding.

The group's leader, Representative Mark Meadows, said on Wednesday evening that while his members disliked the deal, the chances for a shutdown 'are very unlikely because no one wants one.'

At a presser that competed with Ryan's, House Minority Leader Nancy Pelosi said that CHIP should have been taken care of months ago.

'This is like giving you a bowl of doggy doo, put a cherry on top and call it a chocolate sundae. This is nothing,' she said, grasping for words. 'We wanted 10 years. We wanted permanent CHIP.'

A blowup over immigration policy has also prevented lawmakers from reaching a long-term deal to keep the government running.

With government funding set to expire at midnight on Friday, McConnell said Congress is 'not yet ready' to move ahead with a substantial deal, as he called for passage of the short-term funding bill to kick talks to next month.

Sanders said Thursday that the short-term resolution was 'not our first choice' but the White House would support it.