(Reuters) - A federal judge gave the Trump administration the go-ahead on Monday to ban “bump stocks” - rapid-fire gun attachments used in the deadliest mass shooting in modern U.S. history - in a defeat for firearms rights advocates.

Opponents had sought a preliminary injunction saying the government did not have the legal authority to enforce the ban.

“None of the plaintiffs’ challenges merit preliminary injunctive relief,” Washington-based District Judge Dabney Friedrich wrote in a 64-page ruling.

When the rule takes effect as scheduled on March 26, bump stock owners will have to turn in or destroy the attachments, which allow semi-automatic weapons to fire like machine guns with a single pull of the trigger.

President Donald Trump had pledged to ban the devices soon after a gunman used them to shoot and kill 58 people at a country music festival in Las Vegas in October 2017.

The U.S. Department of Justice had announced on Dec. 18 that the ban would be taking effect.

The same day, gun rights advocates sued in federal court to challenge the regulation. They have argued the U.S. Bureau of Alcohol, Tobacco, Firearms and Explosives (ATF) lacked the authority to equate bump stocks with machine guns under decades-old legislation.

One of the laws at the center of the legal dispute was written more than 80 years ago, when Congress restricted access to machine guns during the heyday of American gangsters’ use of “tommy guns.”

Friedrich found courts have regularly recognized the ATF’s authority to “interpret and apply the statutes that it administers,” including the definition of a machine gun.

The plaintiffs, including the Sacramento-based non-profit Firearms Policy Coalition, said in a statement late on Monday they were appealing the decision.

“We are disappointed but unsurprised by the court’s ruling tonight denying a temporary injunction to protect Americans from an unlawful and unconstitutional regulation,” the statement said.

Members of Trump’s Republican Party have fought off perceived threats to the U.S. Constitution’s Second Amendment guaranteeing the right to bear arms.

Trump’s move to ban bump stocks put him at odds on the issue with the National Rifle Association, which had opposed such restrictions.