The war on cops is moving from the streets to the U.S. Supreme Court. Last week, the Justices heard a case that threatens police officers with financial ruin if they make arrests and the charges later get dropped.

It started with a late night bash. District of Columbia police officers were called by neighbors at 1 a.m. to investigate a rowdy party at an unoccupied row house. The police found 21 partygoers, liquor, trash, and used condoms strewn about, the smell of marijuana, and women with cash stuffed in their thongs. The partygoers scattered, hiding in closets.

When questioned, some told police “Peaches had invited them.” Some gave other stories. The police phoned “Peaches,” who admitted not having the owner’s permission to use the house. The police then called the owner, who confirmed no one had permission. Two hours after being summoned, the police made the decision to arrest the partygoers for trespassing — the judgment call at issue in this case.

The charges were later dropped, because it wasn’t clear beyond a reasonable doubt the partygoers knew they were trespassing. But sixteen turned around and sued the police for false arrest and violating their constitutional rights.

They never claimed the police verbally or physically abused them. They sued simply for having been arrested, cuffed and hauled to the police station. Amazingly, the lower courts slapped the police with nearly $1 million in damages and legal fees — one of numerous recent lower court decisions making cops personally liable for decisions they made on duty.

The justices should put a stop to it. Fortunately, the Court has a long record of protecting the police from legal liability, provided there’s no evidence of malice or a deliberate violation of the Constitution.

If merely making an arrest puts cops at risk of getting sued and clobbered with legal fees and damage awards, what police officer will ever make an arrest? One mistake could mean losing their home and everything else. Faced with that risk, who would ever want to be a cop?

Twenty-six states and the federal Justice Department are weighing in with a strong warning that allowing the lower court ruling to stand would have “vast consequences” for law enforcement everywhere. On the other side, the American Civil Liberties Union is pushing to shrink or even eliminate the police’s legal immunity. The ACLU wants police to have no room for error.

Last week’s oral argument signals how the Justices are likely to vote. Justice Stephen Breyer sympathized with the partygoers, suggesting it’s out of “the Middle Ages” to expect them to know who’s hosting. Justice Elena Kagan bragged she herself had gone to parties without knowing who the host was and where “marijuana was maybe present.”

Justice Sonia Sotomayor was determined to play the race card, though race wasn’t raised by either side. She asked “if police officers arrived at a wealthy home and it was white teenagers having a party… I doubt very much those kids would be arrested.” Shame on Sotomayor.

Neighbors called the cops because they were concerned about the debauchery going on next door to them. Of course, people in an upscale neighborhood would do the same. Rich people and poor people, black and white alike, want police protection and quiet enjoyment of their homes.

That protection is being eroded. You can thank Black Lives Matter street protests and pandering politicians. Manhattan Institute scholar Heather Mac Donald reports a nationwide slowdown in policing, because cops are feeling vulnerable and hesitating to make arrests. That means the war on cops is hurting all of us.

A majority of the Justices seem to get that. The Court’s newest member, Justice Neil Gorsuch, has frequently cautioned against courts “second-guessing” police for the actions they take in “tense, uncertain, and rapidly evolving circumstances.” That’s why the Court should rule in favor of legal immunity for the police. Our public safety depends on it.