A decade ago, the harsh punishments meted out to members of a Virginia group that trained for religious combat by playing paintball were hailed by the Justice Department as a victory in the war on terrorism and lambasted by Muslim groups as discrimination.

But a spring Supreme Court decision has led to freedom for two of the men, who were dealt lengthy sentences. A third man, already released from prison, also had his conviction undone, and more are appealing.

Several dozen other defendants in unrelated cases have seen their convictions thrown out as well, and hundreds more hope to, based on Sessions v. Dimaya, a decision on immigration law that also carries significant weight in the realm of gun crimes.

By deeming the definition of a violent felony in immigration law unconstitutionally vague, the Supreme Court put in peril an identical phrase used to put armed criminals in prison with long mandatory minimum sentences.

It’s part of a years-long push within the court that began with the late justice Antonin Scalia against catchall legal clauses that punish the risk of violence rather than actual violence. The case comes as judges have shown an increased willingness to limit legislation — passed during times when crime was surging — that broadly mandated harsher punishments.

This particular disputed language “has been used to put thousands upon thousands of defendants in prison for far longer than they otherwise would have been,” said Aaron Katz, an attorney representing criminal defense attorneys and opponents of mandatory minimums. “The government for two years has been planning for [this clause] to be invalidated, and that’s why they fought Dimaya so hard.”

In fiscal 2016, the U.S. Sentencing Commission says, close to 2,000 people were convicted under the statute, which adds substantial mandatory minimums to violent crimes for involving firearms. More than 52 percent of those convicted were black and nearly 30 percent were Hispanic; 16 percent were white.

It’s unclear how many of those cases relied on the part of the law now in doubt. When a crime involves actual violence or the threat of it, the law still stands. At issue are crimes that merely pose “a substantial risk that physical force” would be used.

That’s the same language Justice Elena Kagan called unconstitutionally “fuzzy” in the Dimaya decision. Across the country, people convicted under that wording are appealing their cases. Defense attorneys say those cases should be reversed across the board, including in convictions where it wasn’t clear whether the jury found violence was involved or just the risk of it. The Justice Department argues the vagueness can be eliminated if judges and juries look at the facts of each case.

What the Supreme Court found unacceptable in Dimaya was that it was doubly vague. The amount of risk that qualifies as criminal is not defined. On top of that, under long-running precedent, judges or juries are not considering the defendant’s actions.

Instead, they look at the risk in an “ordinary case” where such a crime is committed.

In an earlier decision on similar language, Scalia argued that trying to decide whether the typical example of a crime does or does not risk violence involves too much speculation and abstraction: “To take an example, does the ordinary instance of witness tampering involve offering a witness a bribe? Or threatening a witness with violence?”

How broad the impact will be is still unclear. The Supreme Court plans to take up the issue next year.

However, the acquittals in the cases around the “Virginia jihad network” show how the Dimaya decision has rippled already through lower courts.

This summer, a federal judge in Alexandria, Leonie M. Brinkema, released Seifullah Chapman and Masoud Khan from prison, writing that in light of the Supreme Court decision, neither’s convictions stand under the firearm law.

Ali al-Timimi, a prominent Muslim cleric given life in prison for encouraging Khan and others to fight in Afghanistan after the Sept. 11, 2001, terrorist attacks, is also appealing his firearm conviction even though a reversal would not affect his sentence. So is another member of the conspiracy, Muhammed Aatique, who was released in 2007.

The Justice Department has tried to salvage these and other convictions by arguing that the law is constitutional because juries and judges can decide for themselves in each case whether violence was a substantial risk.

Brinkema accepted the Justice Department argument, but she decided that Chapman’s and Khan’s convictions should be overturned based on the evidence presented at trial.

A first conviction under this firearm law, called 924(c), comes with a mandatory five-year sentence. A second conviction — which until this month’s criminal justice reform bill was signed could occur simultaneously — adds 25 years. If the firearm is a machine gun or has a silencer, it can put a defendant in prison for 30 years to life.

The mandatory minimum was passed as part of the Gun Control Act of 1968, legislation inspired by the assassinations of the Rev. Martin Luther King Jr. and Sen. Robert F. Kennedy. In the 1980s, Congress decided those sentences should apply only to violent or potentially violent crimes but made them much harsher.

“The statute is so shoddily drafted,” said Leah Litman, a law professor at the University of California at Irvine. “It’s not language that lends itself to clarity but often leads to severe penalties.”

Those punishments are often controversial, even among judges. In Alexandria, Judge T.S. Ellis III recently directed a team of high-priced lawyers to try to find a way to cut down an armed robber’s 82-year sentence.

There is potentially a way under Dimaya, the lawyers concluded, because the jury instructions included the language the Supreme Court has labeled unconstitutional. In that and other ­cases, judges are waiting for direction from the U.S. Court of Appeals for the 4th Circuit, which will take its position on Dimaya in the case of Joseph Simms, a North Carolina man serving a 16-year sentence for conspiracy to rob a McDonald’s.

After climbing through the restaurant drive-through window, according to court records, Simms threatened the manager and smacked him with a gun. If the judge of his bench trial reevaluated the case based on those facts, Simms would almost certainly be found guilty again of using a gun in a crime of violence.

However, defense attorneys argue that should not be allowed. Instead, they said in recent oral argument, under Dimaya, the firearm charge should apply only if the underlying crime is categorically a violent one — and conspiracy to commit robbery is not.

If the courts accept a case-by-case approach based on specific evidence against a defendant, it is unclear how the system would deal with years-old jury convictions for which witnesses have scattered and evidence may no longer exist.

Other appeals courts around the country have split, 3 to 3, on the issue. A New Mexico arson case has been appealed to the Supreme Court, as has a robbery-conspiracy case from Texas similar to Simms’s. Justice Neil M. Gorsuch suggested in his concurrence in Dimaya a compromise between categories and facts — that the provision would still apply to crimes that in every possible permutation involve a risk of force.

Judges in the 4th Circuit this fall asked during oral argument why the government has changed its perspective completely, having previously argued for the categorical approach.

“We want the right answer,” Assistant U.S. Attorney Phillip A. Rubin told the judges, “whether we had it before or not.”

Read more: