This time, President Trump is right about the law.

As the partial government shutdown entered its third week, Trump announced Friday he is flirting with the idea of declaring a national emergency and circumventing Congress to begin construction of the U.S.-Mexico border wall.

“I can do it if I want,” Trump said. And legally speaking, he can.

In 1976, Congress passed the National Emergencies Act, which permits the president to pronounce a national emergency on a whim, at his discretion. The act offers no definition of “emergency.” It lays out no required criteria; it demands no showing by the president.

Declaring a national emergency also gives the president access to dozens of laws with specialized funds he otherwise would not have.

There are several significant caveats and, while it may be easy to declare a national emergency, Trump cannot just do whatever he wants.

Is there an emergency power that will fund the wall?

Although no statute automatically allocates additional funding to the president during a national emergency, legal experts pointed to two emergency powers that could allow Trump to use Defense Department funding.

One federal statute makes available any unobligated funds originally set aside for military construction projects. The catch, according to Elizabeth Goitein, co-director of the Brennan Center’s Liberty and National Security Program, is that the national emergency must require the use of armed forces.

The second statute permits a president to divert funds from Army civil works projects and reprogram them.

“Any military construction projects have to be both specifically authorized (Congress says, ‘DoD has the authority to build ‘x’’) and funded (Congress provides money for that purpose),” Goitein told The Washington Post.

The reprogramming provision would give Trump the money, but not the authorization. The question, Goitein said, is whether there is an emergency power that allows him to build the wall without additional funding or legal authorization.

When a president activates his authority under the National Emergencies Act, he is required to notify Congress and specify which power he intends to use. Congress can then block it by passing a resolution in both chambers.

“There’s no easy path for him here. It’s not a slam dunk — there would be a legal fight, to be sure,” Goitein said.

Can Trump order the military to seize private land and build the wall?

The U.S. Constitution has an express provision about declarations of war. It is silent on emergency powers.

From the earliest days of the nation’s founding, there has been a debate over how to deal with an emergency, said Ilya Somin, a law professor at George Mason University.

Several attorneys, including Rep. Adam B. Schiff (D- Calif.) and Yale law professor Bruce Ackerman, argued Trump could not unilaterally decide the nation was undergoing an emergency.

Others disagree, averring that Congress yielded statutory authority to the president by passing the National Emergencies Act.

Moreover, this would not be the first time Trump cited his power to declare a national emergency. In November, the caravan of migrants hundreds of miles from the border brought him to the brink. He announced the national state of crisis via Twitter.

The different, and perhaps more dire, debate surrounds Trump’s attempt at using the military to enforce domestic law.

The federal government’s power to seize private property without owners’ consent is known as eminent domain.

Under the Constitution, the Fifth Amendment’s Takings Clause requires that the seizure be for “just compensation,” which is set at the fair market value, and that the property be for public use; there is no emergency power that undercuts these rules.

Private homeowners on the national border may try to resist government seizure of their properties, but as long as the procedural and payment requirements are met, Somin explained, once a court finds eminent domain is permissible, it is effectively a forced sale.

According to Gerald S. Dickinson, assistant professor of law at the University of Pittsburgh School of Law, the military has always had the authority to seize private land. But as a nation, he said, Americans have been uncomfortable with enforcing domestic law through the military.

Trump’s threat of a “military version” of eminent domain necessitates the military acquiring privately owned land along the border to build a wall.

“That raises some questions about the constitutionality of doing that,” he said.

Is this how the government shutdown ends?

Jonathan Turley, constitutional law professor at George Washington University, said, “The National Emergencies Act could be an exit ramp for Trump.”

Republicans in Congress clearly do not want the shutdown to continue, Turley said. The president does not want to admit defeat or be seen as conceding to the Democratic majority in the House.

Knowing the emergency powers will be challenged in court, Trump could seek to use available funds and begin building the wall. A court would quickly decide whether to temporarily enjoin his efforts. The larger case, however, would remain in the system for years, gifting him an excuse to end the congressional impasse.

“This might give him precisely the exit he’s looking for,” Turley said. “The fact that Trump has a credible claim could be the stalemate’s solution. There may not be a definitive answer until the last months of his administration.”

Read more: