WASHINGTON — If President Donald Trump declares a national emergency to force the military to build a wall on the border with Mexico, the Pentagon may have to figure out which military construction projects around the world to cancel, pare back or put on hold in order to free up money for the initiative.

The possibility that Trump will draw on military funds to build the wall using emergency powers comes amid an impasse with congressional Democrats that has led to a partial government shutdown now in its third week. Trump has refused to sign any funding bill to reopen the federal agencies that doesn't include $5.7 billion to begin construction of the wall.

One possible workaround is for Trump to declare a national emergency and order the U.S. military to construct the wall. The president threatened to do so on Friday, saying he could declare a national emergency if he wants to and build the wall "very quickly."

But the law that authorizes the defense secretary to order military building projects in the event of a national emergency requires the Pentagon to draw upon funds that Congress has already appropriated for military construction. The result is that the administration potentially could have to claw back money from projects Congress has debated and funded.

Trump has long touted his administration's spending increases on the U.S. military. During a visit last month to U.S. troops at Al Asad Air Base in Iraq, he said his administration next year would spend even more than the $716 billion it is spending on the military this year.

The president's suggestion that he can build the wall by declaring a national emergency would likely hinge on a little-known section of the U.S. Code governing the military. Section 2808 gives the defense secretary the authority to undertake military construction projects "not otherwise authorized by law" to support any troops deployed in a national emergency requiring the use of the armed forces.

The law limits the spending in such cases. The Pentagon can draw upon only the money that Congress has appropriated for military construction projects but which has yet to be committed by contract to projects. These are known as unobligated funds. Sometimes, they are not all spent.

According to a congressional aide, there is about $10 billion left in unobligated funds for military construction in the current fiscal year's defense budget, in addition to some $13 billion that has rolled over from previous years. The money, however, has been appropriated for specific projects. This aide, and another one, spoke on the condition of anonymity because they are not authorized to speak publicly about the issue.

The Pentagon's leadership would be forced to decide which of the projects in various stages of completion should see their funds diverted or cut, according to the congressional aide and a defense official. The sorts of projects underway include child-care centers on bases and weapons-range complexes. Any decision to delay or scrap military construction projects on the home front could rankle local congressional delegations and cause political pain for lawmakers.

The use of the national emergency powers for military construction theoretically could open up the administration to legal action. The language in the statute allows the defense secretary to order military construction projects deemed necessary to support armed forces deployed in a national emergency. Whether the wall would count as a construction project necessary to support armed forces is unclear.

Steve Vladeck, a professor at the University of Texas Law School, said that the National Emergencies Act allows the president to use Pentagon money on construction projects, but he said there are caveats and limits.

"It's not an unlimited pool of money, and the construction has to be for a military purpose," he said.

Rep. Adam Smith, D-Wash., chairman of the House Armed Services Committee, said Monday that the president has the legal authority but there's no clear legal history on the matter.

"Can he do it?" Smith told CNN. "Yeah, he can. It would be wrong. It would be horrible policy."

Trump later noted that Smith agreed the president had the authority. "No doubt, but let's get our deal done in Congress!" Trump tweeted.

The Pentagon has used the emergency construction authority 18 times since September 2001, according to another congressional aide. In that time, the Defense Department has used the authority only once in the United States — in the aftermath of the Sept. 11 attacks to do construction at military installations storing sensitive materials or demilitarized chemical weapons.

All the other times the Pentagon has used the authority since 2001 have been overseas, in Afghanistan, Iraq, Djibouti and other locations in the Middle East. In those instances, the military has built barracks, power lines, roads and airfields to support troops at war or operating abroad. The same statute allows the Pentagon to undertake military construction to support troops in the event of a declaration of war.

Trump theoretically could also draw on the funds the military uses for stopping drugs from entering the United States if he presents the wall as a counter-narcotics measure.

A separate U.S. statute authorizes the administration to order military construction projects for the purposes of counter-narcotics activities. But according to the congressional aide, that account contains only about $760 million in the current fiscal year budget, far below the more than $5 billion Trump wants this year for the construction of the border wall.

A study by Bernstein Research found that the border wall would cost at least $15 billion and as much as $25 billion in total. In January, the Trump administration requested $18 billion over the next decade for the initial phase of the wall, but Congress did not approve the request.

According to a 2007 report from the Congressional Research Service, the president has broad ability to declare national emergencies, allowing him to establish martial law, seize property, regulate commerce and employ military forces overseas in a war- or peacetime situation.

Both Congress and the courts retain the ability to constrain that presidential power in certain ways. During the 20th century, national emergencies have been declared related to issues such as the Korean War and a postal strike during the Nixon administration. The 1976 National Emergencies Act regulated how such emergencies can be declared and how long they last.

Since that law was enacted, national emergencies have been declared for a variety of reasons, for example to prohibit trade with certain countries or block assets of suspected drug traffickers. The George W. Bush administration declared a national emergency three days after the Sept. 11, 2001, attacks.

"The president of the United States has an enormous amount of power," Smith said, noting that the courts don't have a long history of standing up to executive power. "It's one of the reasons why we need to be really careful about who we elect president."

The Washington Post's Missy Ryan and Dan Lamothe contributed to this report.

