Several migrants who crossed the Rio Grande onto U.S. territory waited for Border Patrol agents on July 17. (Christian Chavez/AP)

A federal judge said Monday that President Trump’s move to sharply restrict asylum requests from people at the U.S.-Mexico border who are fleeing persecution may have violated a federal law that requires U.S. agencies to give 30 days’ public notice of rule changes, but he stopped short of saying he would halt the measure.

U.S. District Judge Timothy J. Kelly of Washington, D.C., indicated he would decide within 48 hours whether to impose a temporary restraining order.

The judge’s comments came in the first court test of the Trump administration’s new rule, which bars migrants from applying for asylum if they passed through a third country en route to the U.S.-Mexico border and failed to seek protection first in that country.

Two refu­gee and migrant advocacy groups filed suit July 16, a day after the government announced the change and on the same day the rule went into effect, imposing the heaviest burden on people from Central American countries, who constitute the vast majority of asylum seekers.

The American Civil Liberties Union has filed a similar federal lawsuit in San Francisco, with a judge there set to hear arguments Wednesday.

The rule “radically rewrites” asylum law, stripping eligibility from migrants fleeing some of the most dangerous places in the world, said Neal Katyal, former acting U.S. solicitor general and partner at Hogan Lovells, which is pro bono counsel in the Washington case.

The lawsuit on behalf of the nonprofit Capital Area Immigrants’ Rights Coalition and the Texas-based Refugee and Immigrant Center for Education and Legal Services argues the rule violates the Immigration and Naturalization Act and the Constitution, as well as public and notice requirements under the Administrative Procedure Act, which governs federal rulemaking.

The groups said the immigration act states clearly that once applicants reach U.S. soil, they have a right to appeal for protection.

But in court Monday during a three-hour hearing, Kelly said plaintiffs have an uphill fight.

He said he thought they had “established a likelihood of success” not on constitutional grounds or under the immigration statute, but over whether a “30 day notice” requirement for a new rule should apply.

But, the judge said, his challenge is to decide whether a restraining order or injunction is warranted to protect an undetermined number of asylum seekers who might face denials in the short time until Aug 14, when the 30-day period would close.

“The Attorney General has decided [the change] is an appropriate way to safeguard the public interest. Why does that not represent a larger interest?” Kelly asked, adding: “Your clients represent a small number of people.”

Arguing for the advocacy groups, Mitchell Reich said it was a “moral certainty” that people, including clients of the two plaintiff group’s clients, are being placed into expedited removal proceedings and being deported because of the rule, adding that 60 percent of the coalition’s clients are subject to the rule change, as well as 94 percent of children it represents.

Speaking metaphorically, Reich said, “We have thousands of clocks striking midnight everywhere around the country,” each representing an individual asylum seeker whose time in the United States could end.

The majority of those who claim fear at the U.S. southern border are granted access to the U.S. immigration system, and many are released from custody while their claims are pending. Because U.S. courts are clogged with a backlog of nearly 1 million cases, it can take months or years before asylum applicants go before a judge.

Justice Department data shows that asylum filings have nearly quadrupled in the past five years and that fewer than 20 percent of Central American applicants are eventually granted protections by U.S. courts.

Deputy Assistant Attorney General Scott G. Stewart argued for the government in court that the changes was needed to address an “ongoing crisis” and “overwhelming crush” at the border, presented by a record number of asylum claims from non-Mexican migrants.

Attorney General William P. Barr said in a statement last week that those who are truly facing persecution should apply for refuge in the first safe place they reach, not the most desirable destination. He likened the surge of asylum claims at the U.S. southern border to “forum shopping” by applicants attempting to exploit American generosity.

The government said it has apprehended 524,446 non-Mexican border crossers in the first eight months of the fiscal year, nearly double the prior two years combined

Under the new rule, Hondurans and Salvadorans would have to be denied asylum in Guatemala or Mexico before applying in the United States, and Guatemalans would have to be denied first in Mexico.

Guatemala and Mexico have not signed on to the plan.

The U.S. government in court filings acknowledged “ongoing diplomatic discussions” and said the rule change “aids ongoing negotiations” with other countries to deter mass migration while aiding refugees “with truly nowhere else to turn.”