WASHINGTON (Reuters) - The U.S. government was to begin a partial shutdown at midnight on Friday after Republican senators failed to muster the votes needed to approve $5 billion that President Donald Trump wants for a border wall fiercely opposed by Democrats.

Trump sought to blame Democrats, who responded by reminding him that he said last week he would be “proud” to shut down key parts of the federal government in order to get funding for a wall on the U.S. border with Mexico.

“We’re going to have a shutdown. There’s nothing we can do about that because we need the Democrats to give us their votes,” Trump said in a video posted to his Twitter account about two hours before a midnight deadline to pass a stop-gap spending bill. “The shutdown hopefully will not last long.”

Republican and Democratic senators had this week reached a deal on short-term funding legislation that did not include the $5 billion Trump wants, but the president said on Thursday he would not sign it.

The shutdown was the latest evidence of dysfunction in Washington and does not bode well for next year, when Democrats will have a stronger hand as they take control of the House of Representatives.

“President Trump has thrown a temper tantrum and now has us careening toward a ‘Trump shutdown’ over Christmas,” Senate Democratic leader Chuck Schumer said on the Senate floor.

“You’re not getting the wall today, next week or on January 3rd, when Democrats take control of the House,” Schumer added.

Hours before the midnight deadline, lawmakers met Vice President Mike Pence and other White House officials in a last-ditch effort to find a compromise funding bill acceptable to both political parties and Trump.

But they were unable to reach a deal, and the House of Representatives and the Senate adjourned, ensuring a partial shutdown.

Talks between Trump’s team and Republican and Democratic leaders were expected to continue over the weekend. The Senate was set to return from recess at midday on Saturday, although it was not clear if it would have any new proposals to consider.

Three-quarters of federal government programs are fully funded through next Sept. 30, including those in the Defense Department, Labor Department and Health and Human Services.

Funding for all other agencies, including the departments of Homeland Security, Justice and Agriculture, was set to expire at midnight on Friday (0500 GMT).

A partial shutdown begins with affected agencies limiting staff to those deemed “essential” to public safety.

‘PROUD’

Whenever there is a government shutdown, Republicans and Democrats typically fight to blame each other.

Trump’s efforts to do that this week were undermined by his own comments during a televised argument with Schumer in the White House on Dec. 11.

“I am proud to shut down the government for border security, Chuck, because the people of this country don’t want criminals and people that have lots of problems and drugs pouring into our country,” Trump said then. “I’ll be the one to shut it down.”

Slideshow ( 11 images )

Before the House and Senate adjourned on Friday, negotiators were discussing $1.6 billion for a range of border security measures - not specifically for a wall - and retaining financial assistance for areas hit by natural disasters that was added by the House, a Republican Senate aide said.

That $1.6 billion would only be $300 million more than the amount that both parties in the Senate approved in a temporary funding bill on Wednesday, only for Trump to reject it.

Trump made a wall along the U.S.-Mexican border to combat illegal immigration and drug trafficking a key campaign promise in the 2016 election, when he said it would be paid for by Mexico.

He sees it as a winning issue for his 2020 re-election campaign. Democrats oppose the wall, calling it unnecessary and ineffective.

Slideshow ( 11 images )

Republican Senators Lamar Alexander and Marco Rubio expressed frustration with what they said was Trump’s shifting position.

Rubio said that earlier in the week Republican senators went with the bipartisan funding bill because Pence had told them the White House was open to such a proposal.

“We had a reasonable path and there was every indication from the president that he would sign it,” Alexander said.

In a series of early-morning tweets on Friday, Trump called on Senate majority leader Mitch McConnell to use a “nuclear option” to allow a Senate vote on legislation with a simple majority, rather than the standard “supermajority” of 60 votes.

But there was not enough support among Republican senators to do so.

The possibility of a government shutdown fed investor anxieties and contributed to another down day for U.S. stocks on Friday. The Dow Jones Industrial Average fell 1.82 percent, the S&P 500 lost 2.06 percent and the Nasdaq Composite dropped 2.99 percent.

The showdown added to tensions in Washington as lawmakers also grappled with Trump’s sudden move to pull troops from Syria, which prompted Defense Secretary Jim Mattis to resign.

Special Counsel Robert Mueller’s investigation of Russian meddling in the 2016 election and possible collusion by Trump’s campaign team is also hanging over the White House.

In a shutdown, critical workers - including U.S. border agents, and nonessential employees - would not get paid until the dispute ends. National parks also would close unless the government declares them essential.

More than half of the 1,700 people who work for the executive office of the president would be “furloughed,” meaning they would be put on temporary leave.