Doanld Trump has for months teased the idea of declaring a national emergency

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

The White House said 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 Trump wants.

Trump has for months 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 country 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 mobilization 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.

Steel companies took the case to the Supreme Court, which ruled in their favor, 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 September 11, 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 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-defense 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 years-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 quickly pass the Democrat-controlled House of Representatives.

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

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

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