The nation’s top prosecutor rescinded asylum seekers’ right to bail after they are apprehended crossing the border illegally, a hard-line Trump administration policy that could jail thousands of adults for months or years but is unlikely to stanch the flow of Central American families into the United States.

Attorney General William P. Barr’s ruling this week, in a case initially taken up by his predecessor, Jeff Sessions, reversed a 2005 Board of Immigration Appeals court decision that said asylum seekers should have a right to bond hearings once they set foot on U.S. soil. Barr said the case “was wrongly decided.” It was his first immigration-related ruling as attorney general.

Barr’s decision sets up another legal battle as the administration contends with a crush of asylum seekers at the boundary with Mexico. Illegal crossings are at a 12-year high, and most asylum seekers are families who are flooding rustic border facilities with children including toddlers and babies. Most are quickly released, frustrating President Trump.

Barr’s decision will not take effect for 90 days to give the Department of Homeland Security time to gear up to potentially detain immigrants.

Democrats assailed the ruling Wednesday as an attempt to detain immigrants indefinitely in the United States and discourage people fleeing violence and poverty from seeking protection.

“This is a disaster, and it is intentional,” Sen. Brian Schatz (D-Hawaii), who sits on the Senate panel overseeing funding for the Justice Department, told The Washington Post. “Barr’s decision to deny bond hearings is another attempt by the administration to use indefinite detention as a deterrent for people who are exercising their right under U.S. and international law to seek asylum. It’s creating a crisis of capacity on purpose.”

The American Civil Liberties Union and other groups said they had expected the ruling — which comes days after a federal judge in Washington state ordered the administration to give detained asylum seekers bond hearings — and would swiftly challenge it in court.

“It’s part and parcel of what Trump has been getting at from the beginning,” said Judy Rabinovitz, deputy director of the ACLU’s Immigrants’ Rights Project. “It’s clearly part of his assault on the asylum system. From the beginning, it’s been, ‘Lock them up.’ ”

Barr’s decision landed a day before acting homeland security secretary Kevin McAleenan and top immigration deputy Matthew Albence appeared at the border Wednesday to call attention to the influx of families — up more than 370 percent from October to March, compared with last year — overcrowded holding facilities and a new bipartisan report calling for a dramatic response to the record numbers of Central American families seeking asylum at the border.

U.S. Customs and Border Protection said Wednesday that it has apprehended more than 414,000 people on the southwest border at the midpoint of this fiscal year, already exceeding last year’s total.

Frustrated by the snowballing numbers, Trump has said immigrants are “gaming the system” and traveling to the border with children because legal limits on detaining children and limited family detention space requires the U.S. government to release them.

In the border city of Yuma, Ariz., Mayor Douglas Nicholls declared an emergency this week, saying the “mass release” of migrants had overwhelmed its shelter space and nonprofits. El Paso, the Rio Grande Valley and others have also seen spikes in the numbers of families crossing.

The president has implored Congress for flexibility to detain families longer until their immigration cases are decided in court. Trump administration officials have also floated ideas such as shutting down the entire U.S.-Mexico border, sending asylum seekers to “sanctuary cities,” where local officials limit cooperation with federal immigration authorities, and giving parents the choice of being detained without their children.

Federal officials moved ahead with plans this week to train a handful of Border Patrol agents as asylum officers, according to two officials with direct knowledge of the plan.

Sen. Ron Johnson (R-Wis.), who chairs the Senate Homeland Security and Governmental Affairs Committee, said in an interview Wednesday that he is preparing legislation to tighten asylum standards. He said he would more swiftly and rigorously assess the claims of asylum seekers while keeping them detained longer so the government could more easily deport them if their asylum claims were denied.

“You have to have the resources to make the determination quickly, but fairly, while people are in detention,” said Johnson, who just finished a two-day trip to the southern border. “I sure don’t want indefinite detention . . . but we need to be able to hold people long enough” to process claims.

As part of his bill, tentatively named the “Families Act,” Johnson said he wants to toughen the credible-fear standard so that half pass their initial screenings, compared with roughly 9 in 10 now. He also wants to ensure migrants can be detained longer.

Johnson said he is considering a maximum detention time of 90 days, although “I’m happy to compromise at 60.”

The Homeland Security Advisory Council, a committee of Democrats and Republicans who advise the secretary, issued an emergency report late Tuesday calling for increased detention space for families and hundreds more immigration judges who could decide their cases within 30 days.

The panel called for three to four large processing facilities on the border with health care, showers and family appropriate holding areas, along with an influx of asylum officers.

The ensuing deportations would likely send a signal to smugglers in Central America that arriving as a family will no longer work if they are not eligible for asylum, said Karen Tandy, who chaired the report and is a member of the council.

“I don’t know of another group of bipartisan, nonpartisan experts who parked their politics at the door and unanimously agreed to a set of recommendations like this,” said Tandy, who ran the Drug Enforcement Administration under President George W. Bush.

Leon Fresco, former deputy assistant attorney general under the Obama administration and who was consulted on the report, said he supported the plan, as long as immigrants would also be provided with lawyers and held only for short periods.

“If someone says that the option of a fair expedited processing of a case of a family cannot be done in America, even though it’s being done all over Europe . . . if we can’t do that, then fine, don’t tell me you’re not for open borders,” Fresco said. “You are for open borders. Let’s be honest about that.”

In November, a federal judge blocked Trump’s asylum ban, which would have prevented asylum for migrants crossing into the United States illegally. And earlier this month, a judge shut down a proposed experimental policy known as Migrant Protection Protocols, which would have required migrants to stay in Mexico while awaiting their hearings.

The judge ordered the program suspended and granted entry to the plaintiffs, a ruling that Trump dubbed a “disgrace,” adding: “We have the worst laws of any country in the world.”

Last week, the U.S. Court of Appeals for the 9th Circuit temporarily allowed the administration to resume its “remain-in-Mexico” policy while it considers the case.

Nick Miroff contributed to this report.