US President Donald Trump is set to declare a "national emergency" to help fund hundreds of kilometres of wall on the southern border to prevent migrants from crossing into the United States illegally from Mexico.

The White House said Mr Trump would also sign a spending bill that would avert a government shutdown, but which only provides $1.375 billion for border barriers or fencing - far from the $5.7 billion Mr Trump wants.

For months the president has teased the idea of declaring a national emergency, which would free up federal money from elsewhere, citing what the administration calls a "crisis" at the border.

More than 100,000 people were detained in October and November after entering the US illegally.

But trying to build a wall this way would face significant legal challenges.

Trump does have emergency powers

The National Emergencies Act allows the president to declare a national emergency, providing a specific reason for it.

That then allows the mobilisation of hundreds of dormant emergency powers under other laws.

Those can permit the White House to declare martial law, suspend civil liberties, expand the military, seize property and restrict trade, communications and financial transactions.

But the powers are not unlimited, and can be blocked by Congress and the courts.

During the Korean War in 1952, President Harry Truman sought to take over US steel factories to keep them producing in the face of a planned national strike by industry workers.

Harry Truman

Steel companies took the case to the Supreme Court, which ruled in their favour, saying the president's emergency powers did not allow him to seize privately owned plants to avert a strike.

All presidents use the National Emergencies Act

Every recent president has used the NEA and more than two dozen states of emergency are currently active, renewed annually.

George W Bush invoked it after the 11 September 2001 Al-Qaeda attacks to be able to expand and ready the military beyond what was budgeted, and to undertake secret surveillance and employ interrogation methods on detainees widely denounced as torture.

Barack Obama tapped the NEA to declare an emergency in 2009 over the swine flu threat, giving authorities and hospitals extra powers to act quickly against the outbreak.

Most often, the NEA has been used in actions against other countries.

One NEA emergency in place since 1979 has restricted trade with Iran. Another, dating from 2006, blocks property of people who were deemed to be undermining democracy in Belarus.

Powers, funds limited

If Mr Trump declares a national emergency, he could deploy more manpower to the border. But to build a wall, he would still have to find billions of dollars to fund it.

One emergency law permits the president to order "military construction projects" using funds already available in the military budget.

But could the wall be called a "military" project? There are strong restrictions on the US military and its funding being deployed for domestic, non-defence purposes, though emergency laws sometimes permit it.

Moreover, building the wall will require taking control of privately owned land that abuts much of the border, which could force long legal battles with landowners.

Challenge from Congress

The NEA gives Congress the right to immediately challenge a presidential emergency declaration, and a challenge would likely pass the Democrat-controlled House of Representatives quickly. 

"It's not an emergency," House leader Nancy Pelosi said.

"We will review our options and be prepared to respond appropriately," she added.

The Republican-controlled Senate would also have to decide whether it agrees with the president's invocation of emergency powers to build a wall.