U.S. Marines with the 7th Engineer Support Battalion, Special Purpose Marine Air-Ground Task Force 7, walk along the California-Mexico border at the Andrade Point of Entry in Winterhaven, California, Nov.30, 2018.

WASHINGTON — The Pentagon is informally scouring military construction projects it could cut or delay in preparation for a possible national emergency declaration by President Donald Trump, which could force the Defense Department to divert funds from those planned initiatives to building a wall on the U.S. border with Mexico, according to people with knowledge of the efforts.

Trump said Thursday he would probably declare a national emergency if he fails to break a deadlock with Democratic lawmakers over funding for the border wall, raising the prospect that the Pentagon will have to figure out how to come up with the cash.

"I have the absolute right to declare a national emergency," Trump said outside the White House before departing for a visit to the border. "I haven't done it yet. I may do it, if this doesn't work out, probably I will do it. I would almost say definitely."

The president has refused to sign any legislation to end the partial government shutdown unless it includes $5.7 billion for the start of construction of the wall. Democrats have refused to provide that funding, resulting a shutdown of certain federal agencies that is now in its third week.

One possible workaround for Trump is a little-known section of the U.S. code governing the military that allows the defense secretary to tap money in the existing military construction budget for urgent projects in support of troops deployed in a national emergency. The statute limits the administration to accessing money that Congress already has appropriated for military construction projects but which has yet to be "obligated" - committed to specific projects by contract.

The president could take a different route, which he was considering Thursday. A separate statute allows the president to terminate or defer Army civil works projects in the event of a national emergency and apply the freed-up resources to matters deemed essential to national defense. Trump is eyeing taking a portion of $13.9 billion in disaster funding Congress allocated to the Army Corps of Engineers that hasn't been spent yet.

If he opts to use military construction funds, there is about $10 billion left in unobligated funds in the current fiscal year's defense budget, in addition to some $13 billion that has rolled over from the past five years, according to a congressional aide, who spoke on the condition of anonymity to discuss sensitive military budget matters. The pot of money is supposed to go to everything from air traffic control towers and upgrades to aircraft hangars to building modern storage facilities for ammunition.

Now officials at the Pentagon have begun going through the projects poised to receive those funds to see which could be scrapped or delayed if the president asks them to pull $5.7 billion from the military construction budget for emergency construction of the wall.

A senior U.S. military official described the effort as an "informal process," with "everyone scouring lists of stuff that can be used, going back five years." The Pentagon has five years to spend military construction funds.

"The Department of Defense is reviewing available authorities and funding mechanisms to identify options to enable border barrier construction," Capt. Bill Speaks, a Pentagon spokesman, said in a statement. "As there has not been such a declaration made, it would be inappropriate to comment further on those efforts."

The Pentagon's search for possible funds doesn't necessarily mean the White House has ordered the military to come up with the money. The Defense Department's planners often get ahead of initiatives the White House has telegraphed to determine how they would execute an order.

Any attempt to take the full $5.7 billion from the roughly $23 billion in unobligated military construction funds would likely result in serious political pain, according to Travis Sharp, research fellow at the Center for Strategic and Budgetary Assessments.

He said many of the projects funded by the money matter to local communities and also their representatives in Washington. "Even with a pot of money $23 billion large, you are going to be hard-pressed to come up with a noncontroversial list of projects that supposedly do not have an impact on readiness and national security if they get cut," Sharp said. "You're talking about cutting over 20 percent of the available funding."

Congressional lawmakers have opposed raiding military funds for the wall. House Armed Services Committee Chairman Adam Smith, D-Wash., has called a national emergency declaration a "terrible idea." Rep. Mac Thornberry of Texas, the top Republican on the committee, told Fox News this week he is "against using Department of Defense dollars for any other purpose."

It is unclear whether the courts would uphold such a move by Trump.

Elizabeth Goitein, co-director of the liberty and national security program at the Brennan Center for Justice, said judges would be unlikely to challenge the president's determination of what constitutes a national emergency requiring the armed forces.

But she said Trump could face other legal challenges, not only because it's unclear that the wall fits the legal definition of military construction, but also because the statute gives the defense secretary access to the funds only for construction projects that support troops deployed in an emergency.

"It certainly seems like it's the other way around here," Goitein said. "It seems like the armed forces are being used in support of the project, which is to build the wall."