(Reuters) - A federal judge on Tuesday struck down the Trump administration’s effort to allow blueprints for making guns from 3-D printers to be posted online.

FILE PHOTO: A general view of the morning sky over the White House in Washington, U.S., May 6, 2019. REUTERS/Jonathan Ernst

U.S. District Judge Robert Lasnik said the State Department violated federal law by letting Defense Distributed, a Texas-based nonprofit, publish downloadable blueprints for the untraceable, undetectable, mainly plastic firearms, as part of a June 2018 legal settlement.

Lasnik cited the State Department’s prior view that publishing such instructions could threaten U.S. foreign policy, national security and even world peace by enabling criminals, including terrorists outside the United States, to obtain the firearms.

“Against these findings, the federal defendants offer nothing” to support the reversal, the Seattle-based judge wrote. “Because the agency action was arbitrary and capricious, it is unlawful and must be set aside.”

The State Department is reviewing the decision. The U.S. Department of Justice, which represented the agency, did not immediately respond to requests for comment.

Chad Flores, a lawyer for Defense Distributed, said it would appeal, and deserved protection under the U.S. Constitution from the “indirect censorship efforts” of the states.

In an email, Flores said, “Appellate courts exist to rein in rogue decisions like this one.”

Lasnik ruled in a lawsuit by 19 U.S. states and Washington, D.C., led mainly by Democrats, to keep the blueprints offline.

Gun rights advocates have said fears about posting the blueprints were overblown, but the states called a ban necessary to protect the public and deny criminals easy access to weapons.

“It is baffling that the Trump administration continued to work so hard to allow domestic abusers, felons and terrorists access to untraceable, undetectable 3D-printed guns,” Washington state’s attorney general, Bob Ferguson, said in a statement.

He said Republican President Donald Trump tweeted one day after the July 2018 lawsuit was filed that he was looking into the public sale of 3-D guns and had spoken to the National Rifle Association, and said the guns did not “seem to make much sense!”

“I’m thankful the court agrees,” said Ferguson, a Democrat.

California, Illinois, Massachusetts, New Jersey, New York, North Carolina, Pennsylvania and Virginia were among the more populous states to join Ferguson’s lawsuit.

Defense Distributed had argued that the earlier ban violated its constitutional rights to free speech and to bear arms under the First and Second Amendments. It had hoped to make its blueprints available to the public in August 2018.

The case is Washington v U.S. Department of State et al, U.S. District Court, Western District of Washington, No. 18-01115.