A Southern California city agreed to pay $1 million and end a discriminatory housing policy aimed at evicting criminals that disproportionately drove Black people and Latino renters from their homes, federal prosecutors said Wednesday in announcing the first settlement of its kind.

The city of Hesperia, San Bernardino County and its sheriff’s department engaged in a pattern and practice of discrimination that violated the Fair Housing Act and Civil Rights Act, according to a consent order.

“Hesperia’s ordinance was a blatantly racially discriminatory solution to a problem that didn’t exist,” Assistant Attorney General Kristen Clarke said. “This meant evictions of entire families for conduct involving one tenant or even guests or estranged family members. It meant evictions of the survivors of domestic violence. It meant evictions in the absence of concrete and real evidence of criminal activity.”

The “historic” settlement was the first in a case challenging so-called “crime-free” housing ordinances and should send a message to an estimated 2,000 cities nationwide that have similar policies in place that are often discriminatory, Clarke said.

The city, county and sheriff’s department denied the allegations and did not admit liability but agreed to settle the case, according to the court order. The city repealed the ordinance last month and the sheriff agreed to stop enforcing it.

Hesperia passed the ordinance in 2015 with the intent of keeping Black people and Latinos from living in the Mojave Desert city some 60 miles (97 kilometers) northeast of Los Angeles, the consent order said.

One city councilmember said the ordinance allowed landlords to remove blight and “compared it to ‘calling an exterminator out to kill cockroaches,’” Clarke said. Another councilmember said it was to correct a “demographical problem” and the people targeted were “of no value to this community.”

The ordinance required landlords to submit prospective tenants’ names to the sheriff for background checks so they could deny housing to anyone with a criminal record, prosecutors said. The sheriff, in turn, would notify landlords if tenants had been in trouble, regardless of whether there was an arrest or conviction, and pressured property owners to evict people who had run-ins with the law.

Hundreds of people were targeted, including people who called police for help and ended up being dislodged as a result, prosecutors said.

A Black woman who repeatedly called police about an abusive boyfriend was forced to move out after the sheriff threatened to file a misdemeanor complaint against the landlord, Clarke said. The woman and her children had to stay in a motel and ended up moving across the country after another rental application in Hesperia was denied.

A Latina who called the police because her boyfriend was having a mental breakdown was forced out temporarily because the boyfriend was arrested when deputies arrived at the home before paramedics.

The bulk of the settlement — $670,000 — will go to tenants who were evicted or to reimburse them for being displaced. Some of the money will fund marketing for fair housing and the sheriff’s department will pay a $100,000 civil penalty, prosecutors said.

A lawyer representing Hesperia said the city settled solely for financial reasons.

“At no time has the city admitted liability in this matter, and the city continues to vehemently deny all allegations contained within the complaint,” Attorney J. Pat Ferraris said in a statement.

A spokesperson for the sheriff said the office can’t comment until the consent is been signed by a judge and dismissed.