U.S. President Donald Trump could be entering "murky" legal territory if he attempted to close down the southern border with Mexico, a move that some observers say could have significant impacts on both economies.

"The implications are pretty grave," said Jock O'Connell, a California-based international trade adviser.

On Friday, Trump, via Twitter, threatened to close the U.S. southern border if Congress continued to refuse to provide more than $5 billion US in taxpayer funds for his promised wall along the border with Mexico. The disagreement has led to the continued partial government shutdown.

"We will be forced to close the Southern Border entirely if the Obstructionist Democrats do not give us the money to finish the Wall & also change the ridiculous immigration laws that our Country is saddled with," Trump tweeted.

'It's very murky'

Trump has threatened to shut down the southern border before. And what he means by closing it down "entirely" and what legal authority he would have to shut down the border is not entirely clear.

We will be forced to close the Southern Border entirely if the Obstructionist Democrats do not give us the money to finish the Wall & also change the ridiculous immigration laws that our Country is saddled with. Hard to believe there was a Congress & President who would approve! —@realDonaldTrump

"It's very murky," said Stephen Legomsky, professor emeritus at Washington University's law school.

Trump has discretion to decide which ports of entry should be established and closed. That is determined by administrative regulations, all within the control of the executive branch of the U.S. government, he said.

Last month, for example, U.S. officials temporarily suspended traffic in both directions at the San Ysidro port of entry between San Diego and Tijuana, disrupting trade at the most heavily trafficked land border in the Western hemisphere.

But if Trump wanted to close all ports of entry, he might be contravening Congress's general intention to set up a particular system for implementing immigration laws, said Legomsky, the former chief counsel of U.S. Citizenship and Immigration Services in the Department of Homeland Security.

"I don't think the president could get away with shutting down all ports of entry," he said. "At some point there has to be a line drawn where if you cross that line you're really undermining the whole system of immigration set up by Congress."

Invoking national security

Both Legomsky and O'Connell suggested that Trump would have a stronger case by invoking "national security" as the rationale to close down the border

And he would likely double down on his claims that the borders are being overrun by a disproportionate number of violent street gangs and Islamic terrorists to justify such action.

"If he leans on national security as the rationale for that action then he most likely has the authority to close down the borders," O'Connell said.

"He could do it indefinitely as long as he insists that there is a clear national security implication involved."

Legomsky agreed that Trump's invocation of national security, justified or not, would make it harder for the court to set aside his actions

"I just don't know whether the court would be quite willing to accept national security at face value," he said.

The courts, he said, might agree that it's possible somebody could come across the border and threaten our national security. But they also might question whether Trump has to shut down all ports of entry in order to prevent that action.

If Trump was able to get his way, and shut down the border, it could result in losses of billions of dollars, said Duncan Wood, director of the Wilson Center's Mexico Institute.

According to one expert, Trump most likely has the authority to close down borders if he can justify it as necessary to protect national security. ( U.S. Marine Corps/ Cpl. Cutler Brice/Handout via Reuters)

Mexico is the United States's third-largest trading partner. In 2017, the U.S exported $243 billion in goods to Mexico, and imported $314 billion worth, according to the U.S. Census Bureau.

Mexico depends on the U.S. for 80 per cent of its exports and would "be hit very, very hard" by a border shutdown, Wood said. "It would cause a very significant and negative impact on the Mexican economy."

As well, the U.S. economy, which depends less on Mexico, would still be "hit really, really hard," he said.

But it's not just the importers and exporters that would suffer impacts from a border shutdown. Blue-collar workers who work for the warehouses and distribution centres, drive the trucks and the trains that move goods across the border would be immediately vulnerable to any trade disruption, O'Connell said.

"So the first people to get laid off are going to be literally armies of blue collar workers," O'Connell said.

Intensify inspections

If not a complete border closure, Trump might also be able to gum it up by ordering the custom officers to intensify their inspections.

"[They] could simply stop every truck and create colossal traffic jams and in effect achieve his purpose that way," O'Connell said. "Not through necessarily ordering a border closing, rather like closing down the border by essentially making it exceedingly difficult for traffic to move."

Searches on every vehicle, every person crossing the border would be a nightmare, with trucks and cars lined up for hundreds of kilometres, Wood said.

"Commerce between the two nations would grind to almost a halt."