Alcohol, Tobacco, & Firearms agents alongside an FBI agent and a St. Louis metropolitan police officer.
CNN  — 

Missouri cannot enforce a controversial state law it says looks to protect gun rights, a federal judge in the state ruled Tuesday, saying the measure ran afoul of the US Constitution.

The US Justice Department argued in a lawsuit it brought against Missouri last year that the “Second Amendment Preservation Act,” which blocks state and local law officials from enforcing federal gun laws, “impairs law enforcement efforts in Missouri” and interferes with the Constitution’s Supremacy Clause, which states that federal laws take precedence over state laws.

In a 24-page decision, US District Judge Brian Wimes agreed with the DOJ’s arguments, ruling that SAPA is “invalidated as unconstitutional in its entirety.”

“State and local law enforcement officials in Missouri may lawfully participate in joint federal task forces, assist in the investigation and enforcement of federal firearm crimes, and fully share information with the Federal Government without fear of (SAPA’s) penalties,” Wimes wrote.

The law’s “practical effects are counterintuitive to its stated purpose,” added Wimes, a nominee of former President Barack Obama. “While purporting to protect citizens, SAPA exposes citizens to greater harm by interfering with the Federal Government’s ability to enforce lawfully enacted firearms regulations designed by Congress for the purpose of protecting citizens within the limits of the Constitution.”

Missouri Attorney General Andrew Bailey, a Republican, said in a statement that the state is “prepared to defend this statute to the highest court and we anticipate a better result” from an appeals court that handles cases out of Missouri.

“The Second Amendment is what makes the rest of the amendments possible. If the state legislature wants to expand upon the foundational rights codified in the Second Amendment, they have the authority to do that. But SAPA is also about the Tenth Amendment. It’s about federalism and individual liberty, so we will be appealing the court’s ruling,” Bailey said.

US Attorney General Merrick Garland praised the ruling Tuesday.

“We are gratified by the Court’s decision, which will allow federal, state and local law enforcement in Missouri to work together to keep their communities safe from gun violence,” he said in a statement.

Prior to filing its lawsuit in February 2022, the DOJ for months sought to overturn the law. US law enforcement officials previously told CNN that federal agents have encountered a number of issues in the state since the law went into effect because local authorities were worried about potentially violating it.

In some cases, police departments had withdrawn their officers from task forces led by federal law enforcement agencies.

Most of the conflicts raised by the law had come in operations involving the federal Bureau of Alcohol, Tobacco, Firearms and Explosives, which enforces gun laws, according to DOJ officials. But other federal law enforcement agencies had encountered issues as well that hampered cases that need federal help.

CNN previously reported that, in one instance, US marshals preparing for an operation with local police to arrest a fugitive allegedly involved in drug trafficking faced a series of last-minute hurdles because of the law.

This story has been updated with additional information.

CNN’s Paul LeBlanc and Evan Perez contributed to this report.