(Reuters) - U.S. President Donald Trump’s proposal to impose a tariff on all Mexican goods to push Mexico to halt a surge in illegal immigrants is likely to be challenged in court and will test the scope of the president’s emergency powers.

Trump dramatically intensified his quest to limit a wave of asylum seekers arriving at the U.S.-Mexico border, including families fleeing violence in Central America, by threatening to impose the tariffs starting on June 10.

Financial markets reeled and business leaders on both sides of the border were taken by surprise, prompting discussions of legal action to curtail Republican Trump’s use of a law never previously applied to impose tariffs.

Jennifer Hillman, a Georgetown Law school trade law professor, questioned Trump’s citation of the International Emergency Economic Powers Act (IEEPA) in his announcement on Thursday night.

“If you read the text of IEEPA, it’s about the president being able to declare a national emergency to be able to stop financial transactions,” said Hillman, a former World Trade Organization judge.

The law has been used by presidents to impose sanctions on countries such as Iran and Sudan but Trump’s proposed novel application of it has never been addressed by the courts, according to legal experts.

“It’s clearly beyond the spirit of the law,” said Jessica Levinson, a professor at Loyola Law School. “But is it within the letter of the law? Possibly.”

Some legal experts said that unlike many of Trump’s immigration policies that have been blocked by courts, the tariff threat may survive a challenge because it was wrapped up as a national security measure.

Challengers would have to show the president was acting outside the letter of the law and national security interest, a difficult standard to meet because of the wide authority given to the executive branch under the act.

Lawyers who advise large corporations said clients were interested in pursuing legal action to block the tariffs, but declined to identify the corporations. The U.S. Chamber of Commerce, a major business lobby group, said it might sue.

The IEEPA gives the president power in times of “unusual and extraordinary threat” to regulate a wide range of economic activity. In 1979, President Jimmy Carter, a Democrat, used the law to block all the assets in the United States belonging to Iran after Americans in Tehran were taken hostage. The U.S. Supreme Court upheld the move, saying the IEEPA “was sweeping and unqualified.”

Using the law as a tool to cut the flow of immigrants arguably falls outside the intent of Congress, which adopted the IEEPA to respond to violent threats, said Raj Bhala, a professor at the University of Kansas School of Law who specializes in international trade.

White House spokesman Judd Deere said on Friday that Trump is acting within his authority to protect national security.

“Industry should be in communication with their counterparts in Mexico to encourage the Mexican government to work with the Administration and stave off the dangerous crisis at our southern border as quickly as possible,” Deere said.

OVERWHELMED

White House officials say the immigration system is overwhelmed by thousands of migrants, many of whom turn themselves over to U.S. border officials to claim asylum.

In April, Trump took a step back from an earlier threat to close the southern U.S. border to stanch the flow of people, under pressure from companies worried that a shutdown would cause chaos for businesses. Trump has been unable to get sufficient funding from Congress to fulfill his 2016 campaign promise to build a wall along the border.

The Mexican tariffs were going to be administered by the Department of Homeland Security, according to a spokesman for the U.S. Trade Representative’s office. Hillman, the former WTO judge, said that was unusual.

Courts tend to defer to the president on national security, as the U.S. Court of International Trade did in March in ruling against a challenge to U.S. steel tariffs imposed by Trump under a different law.

There are other avenues to challenge the tariffs outside U.S. courts.

Bhala said the tariffs would almost certainly run afoul of both the North American Free Trade Agreement and the General Agreement on Tariffs and Trade, or GATT. It is not yet clear how Trump’s tariff threat will affect the trade negotiations with Mexico to replace NAFTA.

Both agreements allow members countries to initiate disputes against one another, and NAFTA also allows investors to take action against governments.

However, Bhala said, the NAFTA and WTO dispute resolution processes are slow, taking years to reach a final judgment, and can be difficult to enforce.

Yet another avenue is to go to the U.S. Congress, said Steven Schwinn, a professor at the John Marshall Law School in Chicago.

“Congress doesn’t need to delegate this kind of authority to the president and particularly this president,” said Schwinn. “If Congress wants to take back that authority, they can take that back.”