WASHINGTON — The Supreme Court on Friday unanimously agreed that a sidewalk preacher from Mississippi could challenge a local ordinance that he said interfered with his religious rights.

The issue before the justices was whether the preacher should be allowed to sue — not the validity of the ordinance itself.

The court’s decision in favor of Gabriel Olivier, an evangelical Christian, was a continuation of a series of rulings in recent years that have bolstered religious rights.

Olivier had regularly staked out a prominent spot in front of a public amphitheater near Jackson, Mississippi, where he and church colleagues preached to concertgoers with bullhorns and banners featuring Scripture and photos of aborted fetuses.

But officials in 2019 restricted demonstrations outside the venue, forcing protesters farther away. Olivier tested the ordinance in 2021 by preaching in the restricted zone. He was arrested, convicted and ordered to pay a fine.

Olivier later sued, but his case was dismissed because he was trying to challenge a law under which he had already been criminally convicted. A 1994 Supreme Court decision generally bars litigation that would call into question a conviction that has not been overturned.

He appealed, saying that individuals found guilty in criminal court should be permitted to file subsequent lawsuits challenging the statute under which they had been convicted. In its unanimous opinion Friday, the court said Olivier’s forward-looking lawsuit could proceed because he was not seeking to obtain release from prison or to avoid paying penalties.

“The suit, after all, is not about what Olivier did in the past, and depends on no proof addressed to his prior conviction,” Justice Elena Kagan wrote for the court. “The suit merely attempts to prevent a future prosecution.”

To rule otherwise would present Olivier with a “dilemma,” Kagan added. He would have to either “flout the law and risk another prosecution, or else forgo speech he believes is constitutionally protected.”

During arguments in December, justices from across the ideological spectrum appeared to express concern about allowing a lawsuit to proceed that could undermine a criminal conviction.

But by the end of the session, a majority of the justices also seemed concerned that Olivier might not have recourse to challenge enforcement of the law in the future if he could not sue.

G. Todd Butler, the lawyer defending the Brandon, Mississippi, ordinance, told the justices that allowing such lawsuits after the fact would implicitly impugn the validity of Olivier’s conviction.

Olivier was represented by First Liberty Institute, the conservative legal organization behind several recent cases in which the justices have expanded religious rights. The group represented a high school football coach who prevailed at the court in 2022 after he was fired for praying at the 50-yard line after his team’s games.

In a statement Friday, Kelly Shackelford, president and chief counsel for First Liberty, said the court’s ruling in favor of Olivier was “not only a win for the right to share your faith in public, but also a win for every American’s right to have their day in court when their First Amendment rights are violated.”

Lower courts had sided with city officials over the preacher, citing the court’s earlier decision. The full 5th U.S. Circuit Court of Appeals also declined to let Olivier sue, but the judges split 9-8.

Olivier’s position was supported in part by the Trump administration, which has argued that his type of forward-looking lawsuit should not be barred by the 1994 decision. The administration urged the justices to allow for a limited set of lawsuits filed by individuals who were not in prison and who were seeking relief from future prosecution..