A federal judge declined Wednesday to halt a move by the Trump administration to sharply restrict asylum requests from people at the U.S.-Mexico border who are fleeing persecution.

The ruling by U.S. District Judge Timothy J. Kelly of Washington, D.C., came in a lawsuit filed by refu­gee and migrant advocacy groups.

The case is the first court test of the 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.

The advocacy groups filed suit July 16, a day after the government announced the change and 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.

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

The two nonprofit plaintiffs, the Capital Area Immigrants’ Rights Coalition of Washington and the Texas-based Refugee and Immigrant Center for Education and Legal Services, argued the rule violates the Immigration and Naturalization Act and the Administrative Procedure Act, which governs federal rule-making.

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

Arguing for the advocacy groups, Mitchell Reich has said it was a “moral certainty” that people, including clients of the two plaintiff groups, are being placed into expedited removal proceedings and being deported because of the rule, adding that 60% of the coalition’s clients are subject to the rule change, as well as 94% 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.

Deputy Assistant Attorney General Scott G. Stewart argued for the government in court that the change was needed to address an “ongoing crisis” and “overwhelming crush” at the border, with 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.

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

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.