The Supreme Court ruled against a man who sued a Customs and Border Protection agent for excessive force on Wednesday, entering the contentious issue of liability and accountability for federal police officers.

The dispute between the owner of the Smuggler’s Inn, which is located just feet from the northern border, and the customs agent came before the justices at a time when lower courts and lawmakers have debated when law enforcement can be sued. Courts have permitted such suits against federal officers in limited circumstances.

In a 6-3 majority opinion, Associate Justice Clarence Thomas stated that it is generally the responsibility of Congress to allow Americans to sue federal police for excessive force violations under the Fourth Amendment.

“Congress is better positioned to create remedies in the border-security context,” Thomas wrote, referring to an internal US Customs grievance procedure.

Associate Justice Sonia Sotomayor argued that the court’s decision on the Fourth Amendment claim “contravenes precedent and will deprive many more individuals who suffer injuries at the hands of other federal officers of an important remedy.” Sotomayor concurred with the court’s decision dismissing the innkeeper’s separate First Amendment claim.

Two other liberal justices joined Sotomayor’s opinion.

Americans may sue state and local police for civil rights violations under a Reconstruction-era federal law, but the law does not apply to federal law enforcement. Claims against federal agencies are instead permitted under a 1971 Supreme Court precedent, Bivens v. Six Unknown Named Agents, in which agents from the then-Federal Bureau of Narcotics searched a man’s home without a warrant.

The key question that has divided lower courts is whether the 1971 precedent allows suits against federal police in other circumstances, or whether the facts of a lawsuit must closely match the warrantless search involved in Bivens.

The Supreme Court has been hesitant to allow lawsuits that raise new claims under new circumstances, arguing that Congress, not the federal courts, should authorize such lawsuits. Fourth Amendment supporters claim that the government’s hesitancy has made it nearly impossible to sue federal officers.

When deciding whether to broaden the circumstances under which a Bivens lawsuit can be filed, Thomas wrote that courts must consider “whether there is any reason to believe that Congress might be better equipped to create a damages remedy.” Associate Justice Neil Gorsuch wrote in a concurring opinion that the answer should always be “yes.”

“The bread and butter of legislative committees is weighing the costs and benefits of new laws,” Gorsuch wrote. “It has no place in federal courts tasked with resolving cases and controversies under current law.”

“The 6-3 conservative majority of the Roberts Court, once again, shuts the courthouse door on individuals victimized by government abuse of power, this time holding that federal border guards cannot be sued, even for flagrant constitutional violations,” writes David Gans of the liberal Constitutional Accountability Center. “It is a serious mistake that betrays our Constitution.”

The criticism is similar to concerns raised about qualified immunity for local police officers in that it raises the question of how much liability police officers should face for jobs that frequently involve split-second decisions. Qualified immunity is a legal doctrine that shields officers from civil rights violations in a variety of situations.

The owner of the Smuggler’s Inn near the Canadian border in Washington state, Robert Boule, claims the Customs agent used excessive force in pushing him to the ground. Erik Egbert, the agent, was on Boule’s property at the time, trying to talk to one of the inn’s guests. Boule intervened and requested that Egbert leave.

Boule also claimed that Egbert violated his First Amendment rights by retaliating against him when he complained about the incident to his superiors at the agency. He claimed that Egbert responded by requesting that the IRS look into the Smuggler’s Inn.

The case against the CPB agent was dismissed by a federal district court. However, the 9th Circuit Court of Appeals in California overturned that decision.