WASHINGTON – The Supreme Court upheld Monday the ability of federal and state governments to prosecute defendants twice for the same crime – a form of double jeopardy that could come into play if President Donald Trump pardons former associates caught up in the Russian election meddling scandal.

The case, which was heard in early December, had appeared to be an opportunity for challengers to block second prosecutions. But during oral argument, it became clear that a majority of justices were wary of letting criminals go free, possibly including some of those previously sentenced.

Associate Justice Samuel Alito wrote the 7-2 opinion, joined by three conservative and three liberal colleagues. Associate Justices Ruth Bader Ginsburg and Neil Gorsuch dissented.

The case gained attention largely because of the possibility that Trump could pardon one or more of his former associates convicted in federal court as part of special counsel Robert Mueller's investigation into Russian interference in the 2016 election.

More:Mueller report: Why so many of President Donald Trump's aides lied to protect him in Russia investigations

If former Trump campaign chairman Paul Manafort was pardoned, he still could face state prosecutions for the same crimes under the court's precedents. That rule applies because state and federal governments are separate sovereigns.

Alito defended the court's ruling on the basis of the Fifth Amendment, historical evidence and "170 years of precedent."

He noted that federal and state governments often have overlapping powers that allow for two layers of regulation. Examples include taxation and rules regarding gambling, alcohol and marijuana, he said.

Ginsburg disagreed. "Different parts of the 'WHOLE' United States should not be positioned to prosecute a defendant a second time for the same offense," she said.

Gorsuch, who has taken up the late Associate Justice Antonin Scalia's penchant for protecting the rights of criminal defendants, said, "A free society does not allow its government to try the same individual for the same crime until it's happy with the result."

The Justice Department and a coalition of 36 states defended the status quo, which has led to successful second prosecutions after acquittals or hung juries.

It enabled Mississippi to convict Edgar Ray Killen of murdering three civil rights workers in 1964 after federal charges didn't stick. It helped the federal government convict two Los Angeles police officers for the notorious 1991 beating of Rodney King after a county jury acquitted four officers of nearly all charges. And it helped federal officials win a guilty plea from a South Carolina police officer for the shooting death in 2015 of Walter Scott, an unarmed black man, after a state jury deadlocked.

If the court were to revert to a strict rule against double jeopardy, Associate Justice Stephen Breyer said when the case was debated, "look at the door we're opening up."

Two years ago, the court ruled 6-2 that Puerto Rico could not prosecute a suspect after his federal conviction because the territory, unlike states, derived its power from the United States. At the time, Ginsburg and Associate Justice Clarence Thomas suggested that the court consider a similar approach for all levels of government.

December's case was brought on behalf of Terance Gamble, who received a one-year prison sentence in Alabama but nearly four years in federal court for the same firearms offense in 2015. Two lower courts upheld the sentences, citing Supreme Court precedent.

Although the terms are running concurrently, Gamble won't be released until next year. Had the federal government been barred from a second prosecution, he would be free.

Groups on Gamble's side argued that the double jeopardy clause prevents abuse by prosecutors. They said it helps in obtaining plea bargains, because defendants cannot hope for a second trial.

Nearly half the states have bars against double jeopardy. That means state prosecutors would need to cite different charges to try Manafort or other former Trump associates convicted in federal court.