SAN DIEGO — A federal judge was irritated when an attorney for dozens of people charged with crossing the border illegally asked for more time to meet with clients before setting bond.

It was pushing 5 p.m. on a Friday in May, and the judge in San Diego was wrestling with a surge in her caseload that resulted from the Trump administration’s “zero-tolerance” policy to prosecute everyone who enters the country illegally.

“It’s been a long week,” U.S. Magistrate Judge Nita Stormes said, suggesting that the court needed more judges and public defenders.

On Monday, the court will try to curb the caseload by assigning a judge to oversee misdemeanor immigration cases and holding large, group hearings that critics call assembly-line justice. The move puts California in line with other border states, and it captures the strain that zero tolerance has put on federal courts, particularly in the nation’s most populous state, which has long resisted mass hearings for illegal border crossing.

Immigration cases were light for the first few months of the year in the Southern District of California. There were no illegal-entry cases in February, only four in March and 16 in April, according to the clerk’s office. But when zero tolerance took full effect, the caseload skyrocketed to 513 in May and 821 in June.

Those numbers pale when compared to other border districts that have been doing mass hearings for years. The Southern District of Texas’ four border-area courts handled nearly 9,500 illegal-entry cases in the eight weeks after zero tolerance took full effect, though those courts saw their numbers balloon too. The District of Arizona carried more than three times California’s number of cases in May.

The mass hearings can be traced back to December 2005, when the Border Patrol introduced “Operation Streamline” in Del Rio, Texas, to prosecute every illegal entry. Over the next three years, the practice spread to every federal court district along the border except California, whose federal prosecutors argued that scarce resources could be better spent going after smuggling networks and repeat crossers with serious criminal histories.

In Tucson, Arizona, a judge sees up to 75 defendants a day, about five to seven at a time, in hearings that last about two hours. The immigrants show up in the clothes they wore when they were arrested, wearing headphones for translation.

In the McAllen, Texas, federal courthouse 73 people who were cuffed at the ankles lined up in six rows of wood benches. They pleaded guilty at the same time in a morning session last month. About two-thirds were sentenced to the few days of time served. The rest got between 10 and 60 days because they had been previously deported or had criminal convictions.

Carol Lam, the U.S. attorney in San Diego when Streamline began until 2007, said zero-tolerance programs are “ultimately ineffective,” saying they boost conviction numbers but don’t have a proportionate impact on reducing crime.

“The sentences become much shorter to the point where everyone is getting time served or a few weeks in custody, and they’re turned around and come back in again,” she said. “At the end of the day, the system grinds down to a halt and things start deteriorating.”

Attorney General Jeff Sessions, who has held up Streamline as a model, was the first attorney general to seriously challenge California’s position. In May, he announced that the Homeland Security Department would refer every arrest for prosecution, which led to widespread separation of children from their parents. Adam Braverman, the newly appointed U.S. attorney in San Diego, had no room to push back.

When prosecutors in California began trying more cases in May, Chief District Judge Barry Moskowitz formed a committee of attorneys and government agencies to minimize the impact, writing that the increased load would cause “strains, issues and problems.”

The court has struggled to get people X-rayed for safety reasons, attorneys say. Jail space has been lacking, requiring some defendants to be housed at jails in Santa Ana and San Bernardino — at least an hour’s drive away — and some in San Luis, Arizona, a nearly four-hour drive from San Diego. Court often runs beyond business hours, once lasting until 10 p.m.

The U.S. attorney’s office in San Diego said in a statement that it was “committed to securing the border and enforcing criminal immigration laws in a way that respects due process and the dignity of all involved.”

The office noted that other districts along the border — in Arizona, New Mexico and Texas — have operated this way for about a decade. Prosecutors from San Diego visited Tucson last month for a firsthand look.

Defense attorneys object to the new court. Reuben Camper Cahn, executive director of Federal Defenders of San Diego Inc., called it separate but unequal and compared it to slavery tribunals.

“They will appear in chains ... their cases will be heard en masse,” he wrote the chief judge.“In this moment, all of us — citizens, lawyers, jurists — must seek the better angels of our nature to navigate the challenges presented,” Cahn wrote last month. “If the Court does this, it will surely reject the (Justice Department’s) abhorrent proposal.”