WASHINGTON — The U.S. Supreme Court is upholding a constitutional rule that allows state and federal governments to prosecute someone for the same crime.

The court’s 7-2 decision today preserves a long-standing rule that provides an exception to the Constitution’s ban on trying someone twice for the same offense.

The case had been closely watched because a ruling for the defendant in this case might have made it harder for states to pursue criminal charges against defendants in the Russia investigation in the event they are pardoned by President Donald Trump.

The court ruled against federal prison inmate Terance Gamble. He was prosecuted by Alabama and the federal government for having a gun after an earlier conviction for robbery.

Justice Samuel A. Alito Jr. wrote in his majority opinion that 170 years of precedent supports the idea that “a state may prosecute a defendant under state law even if the federal government has prosecuted him for the same conduct under a federal statute.”

New York authorities already have indicted Paul Manafort, Trump’s former campaign chairman.

Manafort has been sentenced to more than seven years on federal conspiracy and fraud convictions. He also has been charged with mortgage fraud and other crimes in New York.

Trump could pardon him for his federal convictions, but Manafort still would have to answer to the state charges by the Manhattan district attorney’s office. The president’s pardon power doesn’t extend to state charges.

Had the justices ruled the other way, it might have called into question the ability to prosecute Manafort on the state level.

Justice Ruth Bader Ginsburg dissented from today’s ruling, which she called “adherence to that misguided doctrine.” In a separate dissent, Justice Neil M. Gorsuch wrote, “A free society does not allow its government to try the same individual for the same crime until it’s happy with the result.”