The Supreme Court in Washington. (Patrick Semansky/AP)

The Supreme Court on Tuesday made it harder for those who contend they have been arrested in retaliation for exercising their free speech rights to bring lawsuits against the arresting officers.

If there was probable cause to make the arrest, Chief Justice John G. Roberts Jr. wrote for the court, that generally will be enough to keep a lawsuit from moving forward.

Otherwise, “policing certain events like an unruly protest would pose overwhelming litigation risks,” Roberts wrote. “Any inartful turn of phrase or perceived slight during a legitimate arrest could land an officer in years of litigation.”

But Roberts said the key word is generally. Reflecting a worry expressed at oral argument in the case, the majority carved out an exception if an arrested person can demonstrate that police are using a usually unenforced law to harass.

“For example, at many intersections, jaywalking is endemic but rarely results in arrest,” Roberts wrote. “If an individual who has been vocally complaining about police conduct is arrested for jaywalking at such an intersection, it would seem insufficiently protective of First Amendment rights to dismiss the individual’s retaliatory arrest claim on the ground that there was undoubted probable cause for the arrest.”

Only Justice Sonia Sotomayor dissented from the outcome of the case, which involved an arrest at an Alaskan festival called Arctic Man, “an event known for both extreme sports and extreme alcohol consumption,” Roberts wrote. Sotomayor said the majority’s decision “will yield arbitrary results and shield willful misconduct from accountability.”

But three other justices also wrote to explain their votes. Justice Ruth Bader Ginsburg, for instance, agreed with the ruling against the arrested individual, Russell Bartlett.

But she added: “I would not use this thin case to state a rule that will leave press members and others exercising First Amendment rights with little protection against police suppression of their speech.”

Bartlett was arrested in 2014 by police officers Luis Nieves and Bryce Weight, who accused him of disorderly conduct and resisting arrest. The arrest came after Bartlett allegedly interfered with the officers investigating a case of suspected underage drinking.

The details are disputed, including whether, after handcuffing Bartlett, Nieves said: “Bet you wish you would have talked to me now.”

The charges against Bartlett were eventually dropped, and he filed suit against the officers, saying his free speech rights were violated. The U.S. Court of Appeals for the 9th Circuit in San Francisco said that the suit could go forward, even if there was probable cause on the part of the officers to make an arrest.

The case presented an unresolved issue. The Supreme Court ruled in 2006 that a person pursing a retaliatory prosecution case has to prove the absence of probable cause. But the question of retaliatory arrest has proved harder to decide.

Last term, the court faced the same question in a case brought by Fane Lozman, who was arrested at a Riviera Beach, Fla., city council meeting because he refused to stop talking during the public comments portion of the meeting.

He faced charges of “disorderly conduct” and “resisting arrest without violence,” but those were dropped. Still, lower courts refused to let his case go forward because there was probable cause for the arrest under a different, more obscure Florida law.

In Lozman’s case, the court ruled 8 to 1 that a plaintiff can bring a retaliatory arrest claim if he can prove the arrest was the result of an official municipal policy of intimidation.

But Bartlett’s case is more representative of the normal claims of retaliatory arrest, and Roberts said courts need to make sure officers are not hauled into court without good reason.

“Police officers conduct approximately 29,000 arrests every day — a dangerous task that requires making quick decisions in ‘circumstances that are tense, uncertain, and rapidly evolving,’ ” Roberts wrote, quoting a 1989 opinion. “To ensure that officers may go about their work without undue apprehension of being sued, we generally review their conduct under objective standards of reasonableness.”

The case is Nieves v. Bartlett.