Donald Trump will declare a national emergency to build a wall along the southern US border after failing to secure funding for the measure through Congress.

The president plans on issuing that declaration after he signs the government funding bill that Congress is poised to approve to keep the government funded until the end of the fiscal year and avert a second damaging shutdown in two months. The plan was confirmed by White House press secretary Sarah Huckabee Sanders just before the Senate voted in favour of advancing the funding package.

“I just had an opportunity to speak with President Trump and he’s prepared to sign the bill,” Senate Majority Leader Mitch McConnell said on the Senate floor on Thursday. “He will also be signing a national emergency declaration at the same time.”

Such a declaration from the president is likely to be met with swift legal challenges that could hobble the effort.

In response to the news, speaker of the house Nancy Pelosi said that a national emergency to build the border wall amounts to an “end run” around Congress, and said that Mr Trump has created the crisis he claims is seen at the border. Ms Pelosi confirmed that Democrats could challenge the president in court if he declares the national emergency, and suggested that there are other emergencies like gun violence that are more pressing than the situation at the border.

Trump shuts down US government over Mexico border wall – in pictures Show all 15 1 /15 Trump shuts down US government over Mexico border wall – in pictures Trump shuts down US government over Mexico border wall – in pictures Federal workers and contractors rally against the partial federal government shutdown Getty Images Trump shuts down US government over Mexico border wall – in pictures The US Capitol on the first morning of a partial government shutdown in Washington EPA Trump shuts down US government over Mexico border wall – in pictures Federal workers and contractors rally against the partial federal government shutdown Getty Trump shuts down US government over Mexico border wall – in pictures President Trump speaks with children who called the North American Aerospace Defense Command Santa tracker in the State Dining Room of the White House. He earlier in the day, tweeted that he was 'all alone in the White House' waiting for Democrats to make a deal on border security EPA Trump shuts down US government over Mexico border wall – in pictures Furloughed federal workers pick up free food at a pop-up store of Kraft Heinz Getty Images Trump shuts down US government over Mexico border wall – in pictures Hundreds of federal workers and contractors rally against the partial federal government shutdown Getty Trump shuts down US government over Mexico border wall – in pictures A pedestrian walk past the U.S. Capitol ahead of a possible partial government shut down in Washington, U.S., December 20, 2018. REUTERS/Joshua Roberts JOSHUA ROBERTS Reuters Trump shuts down US government over Mexico border wall – in pictures From left, House Majority Leader Steny Hoyer, Senate Minority Leader Chuck Schumer, Sen. Dick Durbin and Speaker of the House Nancy Pelosi walk to speak to reporters after meeting with President Donald Trump about border security in the Situation Room of the White House. Trump declared he could keep parts of the government shut down for "months or even years" as he and Democratic leaders failed in a second closed-door meeting to resolve his demand for billions of dollars for a border wall with Mexico Evan Vucci AP Trump shuts down US government over Mexico border wall – in pictures Federal workers and contractors rally against the partial federal government shutdown Getty Images Trump shuts down US government over Mexico border wall – in pictures A sign alerts visitors to the closure of the National Archives on the fifth day of a partial government shutdown EPA Trump shuts down US government over Mexico border wall – in pictures Hundreds of federal workers and contractors rally against the partial federal government shutdown Getty Images Trump shuts down US government over Mexico border wall – in pictures Visitors read signs announcing the closure of the White House Visitor Center EPA Trump shuts down US government over Mexico border wall – in pictures President Donald Trump speaks during a round-table discussion on border security and safe communities with State, local, and community leaders in the Cabinet Room of the White House Getty Images Trump shuts down US government over Mexico border wall – in pictures A sign alerts visitors to the closure of the White House Visitor Center on the first day of a partial government shutdown EPA Trump shuts down US government over Mexico border wall – in pictures Furloughed federal workers show their IDs for entering a pop-up store of Kraft Heinz Getty Images

“That’s an option,” Ms Pelosi said of filing legal action against the president if he declares a national emergency. “When the president declares this emergency, first of all, it’s not an emergency.”

Ms Pelosi, the top Democrat in Washington, was not alone in saying that Mr Trump would set a dangerous precedent if he goes through with the state of emergency. Most, though, indicated that they would need to see the text of the declaration to know their position, according to CNN.

“Clearly I have concerns about using this declaration for this set of circumstances,” Senator Roy Blunt, the Republican Policy Committee Chairman, said.

“I generally don’t think it’s a good idea,” Florida Senator Marco Rubio, who was defeated in 2016 by Mr Trump in the Republican primaries, said.

“It’s a bad idea,” Kentucky Rand Paul, who also ran for the Republican nomination in 2016, said.

Support free-thinking journalism and attend Independent events

It is unclear how the American people would respond to Mr Trump declaring a national emergency to build his wall, but polling in recent weeks suggests that the majority of Americans do not support the idea.

A recent CBS News poll, for instance, found that 66 per cent of Americans did not approve of the president declaring a national emergency to build the wall.

The tentative government funding deal that will be voted on in Congress on Thursday would provide far less funding than the $5.7bn (£4.45bn) that Mr Trump previously demanded, with just under $1.4bn (£1.09bn) that will be used to fund 55 miles (89km) of new wall.

“Reviewing the funding bill with my team at the [White House],” Mr Trump tweeted on Thursday morning.

The bill would ensure that the 800,000 government workers who were furloughed or forced to work without pay for 35 days starting in late December will not suffer a similar fate.

During that time, federal employees were forced to find second jobs to pay the bills – often by driving Uber, or through online fundraising – and for petrol to get them to and from the jobs for which they were not receiving pay.