President Donald Trump has repeatedly suggested in recent days that he could declare a "national emergency" to get funding for his proposed wall on the U.S.-Mexico border. Even if such a move is legal, it's a bad idea with some potentially scary ramifications.

"We can call a national emergency because of the security of our country. We can call a national emergency and build [the wall] very quickly," Trump said at a press conference on Friday. He doubled down yesterday, telling reporters that he "may declare a national emergency dependent on what's going to happen over the next few days."

So how would this work? In 1976, President Gerald Ford signed into law the National Emergencies Act, which authorizes the president to, well, declare national emergencies. According to a 2007 report from the Congressional Research Service (CRS), the president's authority during a national emergency could be broad.

"Federal law provides a variety of powers for the President to use in response to crisis, exigency, or emergency circumstances threatening the nation," the CRS report says. These include powers the president can use whenever he pleases, as well as "statutory delegations from Congress" that are only to be used during an official national emergency. "Under the powers delegated by such statutes, the President may seize property, organize and control the means of production, seize commodities, assign military forces abroad, institute martial law, seize and control all transportation and communication, regulate the operation of private enterprise, restrict travel, and, in a variety of ways, control the lives of United States citizens," the report reads.

As Elizabeth Goitein, co-director of the Liberty and National Security Program at the Brennan Center for Justice, noted in The Atlantic, that's a heck of a lot of power for one man. Hypothetically, Trump could take control of the internet (or really any kind of electronic communications), freeze bank accounts, and use the military to keep order.

It's highly unlikely he'd actually do this. According to the CRS report, "the President must indicate…the powers and authorities being activated to respond to the exigency at hand." Trump says he's concerned with securing the border, so even if he did declare a national emergency, any actions he took would most likely be limited to funding and constructing his border wall.

There are other safeguards in place as well. Unless Trump were to renew it, his state of emergency would last only a year. Congress can pass a resolution to end the state of emergency before then. Such a resolution would easily make it through the Democrat-controlled House, and possibly even the Senate, where four Republicans could vote with Democrats to override the GOP's 53-47 majority.

But there are no guarantees these safeguards will work. There are already 30 states of emergency currently in effect, according to Goitein, and the Brennan Center suggests Trump has plenty of emergency powers thanks to more than 100 statutory provisions. "Most of the statutory powers available during a national emergency have never been used," Goitein wrote. "But what's to guarantee that this president, or a future one, will show the reticence of his predecessors?"

How would declaring a national emergency get Trump his wall? That's where Title 10 of the U.S. Code comes in. The law says

In the event of a declaration of war or the declaration by the President of a national emergency in accordance with the National Emergencies Act that requires use of the armed forces, the Secretary of Defense, without regard to any other provision of law, may undertake military construction projects, and may authorize the Secretaries of the military departments to undertake military construction projects, not otherwise authorized by law that are necessary to support such use of the armed forces.

Notably, such construction projects can be funded using only unallocated Department of Defense money. "DoD has a big pile of money for military construction," University of Texas School of Law Professor Stephen Vladeck told NBC News, so "the question is whether DoD would use that money and might even cancel other construction projects just to build the wall."

There are other legal questions regarding Trump's ability to use money from the Pentagon's budget to build his wall. According to Bruce Ackerman, a law professor at Yale: "Not only would such an action be illegal, but if members of the armed forces obeyed his command, they would be committing a federal crime." In a Saturday op-ed for The New York Times, Ackerman argued that using the military to enforce domestic immigration law is unconstitutional. He cited the example of former President Harry Truman, who tried to nationalize the steel mills in the midst of the Korean War in 1952, only to be rebuffed by the Supreme Court.

Of course, it's impossible to predict how things would play out if Trump did declare a national emergency. He would likely face a court challenge, as Rep. Adam Smith (D–Wash.) said yesterday on ABC's This Week.

It may technically be legal, as federal law does allow for the "military version of eminent domain" if it's "needed in the interest of national defense." But declaring a national emergency over border wall funding is a bad idea. The immigrants crossing the border into the U.S. do not represent a national emergency, and so building a wall to stop them is not an issue of national defense. The White House might claim that terrorists are pouring into the country, but as Fox News host Chris Wallace pointed out yesterday, the State Department has found "no credible evidence indicating that international terrorist groups have… sent operatives via Mexico into the United States."