A federal judge has blocked Virginia from enforcing a law that would prohibit federal immigration agents from wearing masks while on duty, siding with the Department of Justice.

Senior U.S. District Judge Robert E. Payne granted the DOJ's request for a preliminary injunction Tuesday, preventing the law from taking effect Wednesday. The injunction will remain in place as the legal challenge proceeds.

Payne found that the federal government is likely to succeed on the merits of its case because Virginia's law attempts to regulate how federal officers enforce immigration laws, which violates the Constitution's Supremacy Clause. The judge also determined that the government would likely suffer irreparable harm, as enforcing the law could expose federal employees to a "real risk of physical harm" during immigration enforcement duties.

The lawsuit challenged two laws signed by Virginia Governor Abigail Spanberger, which the DOJ argued would subject masked federal agents to criminal penalties and jeopardize agreements between federal immigration authorities and local law enforcement.

"Law enforcement officers risk their lives every day to keep Americans safe, and they do not deserve to be doxed or harassed simply for carrying out their duties," Acting Attorney General Todd Blanche stated when the lawsuit was filed. "Virginia's anti-law enforcement policies regulate the federal government and are designed to create risk for our agents. These laws cannot stand."

The DOJ contended that Virginia was attempting to dictate federal law enforcement operations by restricting the use of face coverings, requiring agents to display identifying information, and placing conditions on cooperation agreements with ICE.

Under Virginia's law, federal officers who violated the mask and identification requirements could have faced a Class 1 misdemeanor, punishable by up to 12 months in jail, a fine of up to $2,500, or both.

Payne's order specifically addresses the mask and identification law. A separate challenge to a provision governing immigration enforcement agreements will proceed on a different schedule, with a hearing set for August 3.

Virginia Attorney General Jay Jones and Fairfax County Commonwealth's Attorney Steve Descano were named as defendants in the lawsuit. Governor Spanberger's office has previously rescinded an executive order that directed state law enforcement agencies to cooperate with federal immigration authorities.