WASHINGTON – The Supreme Court on Friday said devices that turn a semi-automatic rifle into something closer to a machine gun are legal, a win for gun rights advocates and a blow to efforts to reduce gun violence that has besieged the nation.

The court split 6-3 along ideological lines in deciding that the federal government was wrong to classify a bump stock as a machine gun.

“A bump stock does not convert a semi-automatic rifle into a machinegun any more than a shooter with a lightning-fast trigger finger does,” Justice Clarence Thomas wrote in his opinion for the majority.

Justice Sonia Sotomayor, who read the liberals’ dissent from the bench, said the majority used an “artificially narrow definition” to reach a conclusion that will have “deadly consequences.”

“When I see a bird that walks like a duck, swims like a duck, and quacks like a duck, I call that bird a duck,” she wrote of the effect of using a bump stock to enable a weapon to fire at rates approaching those of some machine guns.

The controversial devices were banned by the Trump administration after the deadliest mass shooting in the nation’s history. A gunman who used bump stocks on some of his many weapons fired at concertgoers in Las Vegas in 2017, immediately killing 58 people.

But the Bureau of Alcohol, Tobacco, Firearms and Explosives’ 2018 conclusion that bump stocks meet the legal definition of a machine gun was a reversal from past decisions.

During the Supreme Court’s oral arguments in February, the conservative justices – many of whom have longstanding concerns about the regulatory power of federal agencies – were troubled about the carnage the devices can cause but also wondered if the Justice Department had too broadly interpreted a firearms law.

The hyper technical issue they were asked to resolve was whether a rifle with a bump stock fires more than one shot “automatically” and “by a single function of the trigger.”

The bump stock harnesses the recoil of the rifle to accelerate trigger pulls, technically “bumping” the trigger for each shot after it bounces off the shooter’s shoulder. A rifle can then fire between 400 and 800 rounds per minute.

The justices had to decide if that means a bump stock allows the weapon to be continually fired once the shooter depresses the trigger or if the trigger is reactivated by the shooter between every shot.

The majority said firing multiple shots with a bump stock requires more than a single function of the trigger because the shooter most maintain forward pressure on the rifle’s front grip.

“Without this ongoing manual input, a semiautomatic rifle with a bump stock will not fire multiple shots,” Thomas wrote.

Justice Samuel Alito, in a concurring opinion, said there’s little doubt that when Congress banned machine guns, lawmakers would have seen no real difference between a machine gun and a semiautomatic rifle equipped with a bump stock.

But that’s not how the law was written, Alito said, so the “simple remedy” is for Congress to amend it.

California Gov. Gavin Newsom, a Democrat, said Congress must act.

“This decision will put blood on our streets,” Newsom posted on social media. “That blood will be on the hands of every Republican in Congress who has refused to enact common sense reforms.

President Joe Biden on Friday called on Congress to ban bump stocks. Senate Majority Leader Chuck Schumer, D-N.Y., said Senate Democrats are ready to do so “but we will need votes from Senate Republicans.”

Efforts to pass legislation after the Las Vegas shooting ran up against opposition from the National Rifle Association, which is why the Trump administration turned to administrative action according to Adam Winkler, author of “Gunfight: The Battle over the Right to Bear Arms in America.”

“Given the Supreme Court hostility to administrative agencies, the NRA correctly predicted that such agency regulation would be more susceptible to challenge,” said Winkler, a professor at UCLA School of Law.

In fact, the NRA said Friday the court’s decision will be pivotal in fighting future ATF regulations.

“The Supreme Court has properly restrained executive branch agencies to their role of enforcing, and not making, the law,” said Randy Kozuch, executive director of the NRA Institute for Legislative Action.

Michael Cargill, a gun shop owner and gun rights advocate from Austin, Texas, sued the government over the ban. The 5th U.S. Circuit Court of Appeals sided with Cargill and the Biden administration appealed.

In its decision, the appeals court said that the government was seeking to ban bump stocks “by administrative fiat,” even though the ATF had previously permitted the devices.

Congress banned automatic weapons for private use through a 1934 law, after machine guns became the weapon of choice for gangsters like Al Capone and John Dillinger.

Unlike another case before the court this year – whether domestic abusers can own guns – this one didn’t rest on the 2nd Amendment.

But it was still of high concern to gun rights advocates who pointed out that hundreds of thousands of Americans own bump stocks, relying on the government’s pre-2018 determinations that they are allowed.

Advocates also feared that if the ATF won the case, the agency would go after semi-automatic weapons.

Gun control groups call bump stocks a “unique danger to society.”

Likewise, the American Medical Association, whose members said they’ve seen first-hand the “enormous human carnage, destruction and chaos” caused by rapid-fire bullets, said firearms modified by bump stocks “have no place in a civilized society.”

The case is Garland v. Cargill.