The five-member board of supervisors voted unanimously Tuesday to authorize the payment, mostly to undocumented immigrants arrested on criminal charges and then held after a judge ordered them released so that federal agents could attempt to deport them. The settlement still must be approved by the judge overseeing the case, lawyers for the plaintiffs said.

The class-action lawsuit affects an estimated 18,500-plus immigrants detained from October 2010 to June 2014 in Los Angeles County jails, according to the American Civil Liberties Union and immigrant advocacy groups that brought the lawsuit in federal court. The payouts will range from $250 to $25,000 apiece, depending on factors such as how long they were detained, lawyers said. Unclaimed money will be deposited in a fund to provide legal aid to people fighting deportation.

The lawsuit, filed in 2012 in U.S. District Court in Los Angeles, argued that the sheriff’s department overstepped its authority by effectively rearresting immigrants for the civil violation of being in the United States illegally, after the judges in their criminal cases had ordered them released. Some were held for months at a time.

The case is the largest known settlement reached on behalf of detainees, lawyers for the plaintiffs said.

“This is a very significant settlement and it is hopefully a wake-up call to law enforcement agencies around the country who continue to hold people for ICE,” said Jennie Pasquarella, director of immigrants’ rights and senior staff attorney at the ACLU of Southern California.

Lawyers said they plan to publicize the settlement in hopes of locating all the class members, some of whom may have been deported to nations such as Mexico. Although most are probably undocumented, the group also includes green-card holders and some wrongly detained U.S. citizens, they said.

The lawsuit centered on the “immigration detainers” that ICE routinely sends to law enforcement agencies to ask that they detain immigrants already under arrest on state or local charges so that federal agents can take them into custody and try to deport them to their native countries.

The Los Angeles County Sheriff’s Department used to routinely detain immigrants for federal officials and was among the agencies that helped the Obama administration reach record levels of deportations, surpassing 400,000 a year at its peak.

But the sheriff’s department stopped cooperating with ICE in 2014, amid outcry in a state where nearly 27 percent of the population are immigrants, according to the census.

California has since passed laws to limit state and local assistance with immigration enforcement, and hundreds of other local governments have followed suit, drawing criticism from President Trump, who has deported fewer than 300,000 immigrants a year.

The Supreme Court in June let stand a state law that prohibits local law enforcement in most cases from assisting federal immigration agents.

Advocates for immigrants said the settlement should serve as a warning to state and local law enforcement agencies that they can be held financially responsible for detaining immigrants if they do not have the legal authority to do so. Some states, such as Texas, authorize detentions in state law.

“I hope it’s a stark reminder to state and local law enforcement that when they are honoring these illegal immigration detainers that they really run significant financial liability,” said Mark Fleming, associate director of litigation for the National Immigrant Justice Center in Chicago, which is also involved in the lawsuit.

ICE did not immediately respond to a request for comment about the proposed settlement.

But Los Angeles County Sheriff Alex Villanueva said during the board of supervisors meeting that he was dismayed the $14 million would come from the sheriff’s budget, and not the general fund, because past sheriffs and administrators were responsible for the conditions that led to the lawsuit.

“I kicked ICE out of the jails, and I banned all transfers of inmates to the custody of ICE,” he said. “It’s morally indefensible to slap the current sheriff’s department in 2020 with the mistakes of previous sheriffs and previous boards of supervisors.”

Lawyers said much of the cooperation occurred under former sheriff Leroy “Lee” Baca, 78, who is serving a three-year sentence in federal prison for obstructing an investigation into his agency.