The Supreme Court on Monday ruled 6 to 3 that state court juries must be unanimous to convict a defendant of a serious crime, a decision that scrambled the court’s usual ideological lineups and prompted soul-searching among some justices about when to overturn precedent.

Louisiana and Oregon are the only two states that do not require unanimity for major crimes, and Justice Neil M. Gorsuch said each state’s decision was rooted in discrimination. Although unanimity is not mentioned in the Constitution’s guarantee of an unbiased trial, he wrote, it is clear what is required.

“Wherever we might look to determine what the term ‘trial by an impartial jury trial’ meant at the time of the Sixth Amendment’s adoption — whether it’s the common law, state practices in the founding era, or opinions and treatises written soon afterward — the answer is unmistakable,” Gorsuch wrote. “A jury must reach a unanimous verdict in order to convict.”

But it was not so obvious to a previous court. In a 1972 opinion, the Supreme Court ruled 5 to 4 that the Sixth Amendment requires unanimous verdicts in federal trials. But one of the five, Justice Lewis F. Powell Jr., said unanimous verdicts were not required in state trials.

Whether to overrule the decision in Apodaca v. Oregon and a companion case, Johnson v. Louisiana — and whether Powell’s view was a precedent at all — deeply divided the court.

Agreeing with Gorsuch on the outcome of the current case were liberal justices Ruth Bader Ginsburg, Stephen G. Breyer and Sonia Sotomayor, as well as Gorsuch’s fellow conservatives Clarence Thomas and Brett M. Kavanaugh. But Thomas disagreed with Gorsuch’s reasoning, and Sotomayor and Kavanaugh wrote separately to explain their reasons for overruling a previous decision.

On the other side were two conservatives — Chief Justice John G. Roberts Jr. and Justice Samuel A. Alito Jr. — and liberal justice Elena Kagan, who has become the justice most reluctant to overturn precedent.

One of the most debated and closely watched developments on the court is how the conservative majority will view stare decisis, the doctrine advising that past decisions of the court should not be easily discarded. Liberals worry the ascendant conservatives will cast aside decisions on hot-button issues such as abortion rights and protection against discrimination.

Alito noted in his dissent: “By striking down a precedent upon which there has been massive and entirely reasonable reliance, the majority sets an important precedent about stare decisis. I assume that those in [today’s] majority will apply the same standard in future cases.” Kagan did not join that portion of his opinion.

The Louisiana case was brought by Evangelisto Ramos, convicted of second-degree murder in 2016 on a 10-to-2 jury vote and sentenced to life in prison. “Instead of the mistrial he would have received almost anywhere else, Ramos was sentenced to life in prison without the possibility of parole,” Gorsuch noted.

Gorsuch agreed with attorneys for Ramos that the laws in Louisiana were the result of a Jim Crow attempt to diminish the impact of African Americans serving on juries.

Gorsuch agreed — and devoted a large portion of his opinion to the past.

“Louisiana first endorsed nonunanimous verdicts for serious crimes at a constitutional convention in 1898,” he wrote. “According to one committee chairman, the avowed purpose of that convention was to ‘establish the supremacy of the white race,’ and the resulting document included many of the trappings of the Jim Crow era.”

He added: “Adopted in the 1930s, Oregon’s rule permitting nonunanimous verdicts can be similarly traced to the rise of the Ku Klux Klan and efforts to dilute ‘the influence of racial, ethnic, and religious minorities on Oregon juries.’ ”

Gorsuch attacked the logic of the court holding that unanimity was required in federal trials but not state trials. In such cases, he said, it makes sense for the court to overturn such a decision.

“Even if we accepted the premise that Apodaca established a precedent, no one on the Court today is prepared to say it was rightly decided, and stare decisis isn’t supposed to be the art of methodically ignoring what everyone knows to be true,” Gorsuch wrote.

Sotomayor wrote separately to explain why she was joining Gorsuch.

“While overruling precedent must be rare, this Court should not shy away from correcting its errors where the right to avoid imprisonment pursuant to unconstitutional procedures hangs in the balance,” she said.

Kavanaugh and Gorsuch were extensively questioned by Democrats at their confirmation hearings about respecting Supreme Court precedent, the questions usually preceded by worries about Roe v. Wade, the decision that first established a right to abortion.

Both have shown themselves comfortable overturning precedent, and Kavanaugh wrote that Ramos’s case was a good example of when past decisions should be reconsidered: “Why stick by an erroneous precedent that is egregiously wrong as a matter of constitutional law, that allows convictions of some who would not be convicted under the proper constitutional rule, and that tolerates and reinforces a practice that is thoroughly racist in its origins and has continuing racially discriminatory effects?”

Alito said that it was “deplorable” if Louisiana and Oregon had been motivated by discrimination in building their trial systems but that it had nothing to do with the “broad constitutional question” of whether the Constitution required the same system for federal and state courts.

He said Louisiana and Oregon had relied on past Supreme Court decisions to convict thousands of criminals and now “face a potential tsunami of litigation” from those convicted under the now-discredited system.

Gorsuch said it was unclear how many could challenge their convictions. The ruling would apply only to those whose cases are ongoing, and it would be up to future litigation to decide whether it should apply retroactively.

Ben Cohen, Ramos’s lawyer at the Promise of Justice Initiative, said in a statement: “We have been bringing challenges to Louisiana’s outlier split jury rule to the U.S. Supreme Court since 2004. We are heartened that the Court has held, once and for all, that the promise of the Sixth Amendment fully applies in Louisiana, rejecting any concept of second-class justice. In light of the COVID-19 crisis, it is essential that prisoners who are wrongfully incarcerated be given the chance for release as soon as possible.”

Civil rights groups also praised the decision.

“The reality of historical and ongoing racial discrimination makes unanimous juries particularly essential to the legitimacy of trials in the American justice system,” said Sherrilyn Ifill, president of the NAACP Legal Defense and Educational Fund. “The Supreme Court’s decision today marks a step forward in the long road to ensuring an unbiased jury system, which is essential for protecting our democracy.”

Louisiana voters in 2018 passed a referendum measure requiring unanimous verdicts in felony trials. But it applied only to crimes committed after Jan. 1, 2019, and thus did not affect Ramos.

The case is Ramos v. Louisiana.