President Trump signs short-term spending bill to keep government running through Dec. 22

President Trump signed stopgap legislation Friday to prevent a government shutdown ahead of the midnight Friday deadline.

The continuing resolution (CR) was sent to the president’s desk after passing both the House and the Senate late Thursday. The bill keeps federal agencies functioning for an additional two weeks through Dec. 22.

“@POTUS just signed H.J. Res 123- the short term CR that provides FY18 appropriations to fund the fed govt thru Friday Dec. 22,” White House Press Secretary Sarah Sanders tweeted Friday.

The White House expected Trump would sign the legislation, and laid out its goals Thursday for the upcoming budget bargaining, saying that money for the military, including for missile defense and security along the border with Mexico “must be prioritized in a long-term funding agreement.”

The bill passed the House 235-193, with 18 Republicans voting against it and 14 Democrats voting for it. The Senate vote was 81-14, with Sens. Elizabeth Warren, D-Mass; Bernie Sanders, I-Vt.; Ted Cruz, R-Texas; and John McCain, R-Ariz., among those who cast “no” votes.

While the CR keeps the government running for now, it sets up a budget battle for later this month when the funding is set to expire again. The bill was aimed to give negotiators more time to settle differences ahead of the pre-Christmas showdown.

The measure makes money available to several states that are running out of funds for the Children’s Health Insurance Program, a widely popular program that provides medical are to more than eight million children.

On Thursday afternoon, Trump and the so-called “Big Four” congressional leaders –Senate Majority Leader Mitch McConnell, R-Ky.; Senate Minority Leader Chuck Schumer, D-N.Y.; House Speaker Paul Ryan, R-Wis.; and House Minority Leader Nancy Pelosi, D-Calif., met at the White House to discuss a strategy to avoid a government shutdown after the CR expires on December 22.

Pelosi had told reporters Thursday that lawmakers “will not leave here” without a deal to help immigrants who came to the U.S. illegally as children and are enrolled in the Deferred Action Childhood Arrivals (DACA) program, which Trump ended three months ago.

White House press secretary Sarah Sanders said Trump, Ryan and McConnell agreed that negotiations on immigration "should be held separately on a different track, and not as part of the government funding bill." Sanders also said that Trump "reiterated his priorities for ensuring any immigration package ends chain migration, constructs a border wall, and substantially strengthens immigration enforcement to stop illegal immigration and visa overstays."

McConnell and Ryan issued a joint statement calling the meeting with Trump "productive," and added that they "stressed the need to address border security, interior enforcement and other parts of our broken immigration system and that this should be a separate process and not used to hold hostage funding for our men and women in uniform."

In a joint statement of their own, Schumer and Pelosi said the group "had a productive conversation on a wide variety of issues. Nothing specific has been agreed to, but discussions continue."

Most House Democrats opposed the short-term bill, but more than enough supported it in the Senate to allow its passage. Democrats are expected to use their leverage to insist on future spending boosts for health care, infrastructure and other domestic programs that would match increases Republicans want for defense.

Trump unexpectedly tossed a political hand grenade into the mix Wednesday when he told reporters that a shutdown "could happen" and blamed Democrats. He said they want "illegal immigrants pouring into our country, bringing with them crime, tremendous amounts of crime."

In response, Pelosi tweeted that Trump was "the only person talking about a government shutdown."

Last week, the president invited the same group to the White House to discuss a bipartisan budget deal – but Schumer and Pelosi decided not to show.

Trump accused the Democratic leaders of being “all talk” and “no action.”

“And now, it’s even worse. Now it’s not even talk. So they’re not showing up for the meeting,” Trump told reporters last week. The president was sure to keep two empty seats with the Democratic leaders’ name tags on either side of him in an apparent effort to shame them for boycotting the meeting.

Fox News' Serafin Gomez and The Associated Press contributed to this report. 

Brooke Singman is a Politics Reporter for Fox News. Follow her on Twitter at @brookefoxnews.