A federal judge has blocked the public availability of blueprints that provide instructions for making guns using 3-D printers, just hours before the documents were expected to be published online.

U.S. District Court Judge Robert S. Lasnik granted a temporary restraining order Tuesday night barring a trove of downloadable information about creating the do-it-yourself weapons.

Eight attorneys general and the District of Columbia argued that the instructions posed a national security threat. New York Gov. Andrew Cuomo (D) on Tuesday also issued a cease-and-desist order against the man who was scheduled to post them online.

“In a major victory for common sense and public safety, a federal judge just granted our request for a nationwide temporary restraining order — blocking the Trump administration from allowing the distribution of materials to easily 3-D print guns,” New York Attorney General Barbara Underwood said in a statement. “As we argued in the suit we filed yesterday, it is — simply — crazy to give criminals the tools to build untraceable, undetectable 3-D printed guns at the touch of a button. Yet that’s exactly what the Trump administration decided to allow.”

Cody Wilson, the founder of a nonprofit organization that planned to publish blueprints for 3-D-printed guns, holds one such pistol in 2013. (Jay Janner/Austin American-Statesman/AP)

Josh Blackman, a lawyer who represents Cody Wilson, the founder of the nonprofit that planned to post the instructions, said the restraining order violates protected First Amendment rights.

“We were disappointed in the ruling and view it as a massive prior restraint of free speech,” Blackman said.

Lasnik will hold a hearing on Aug. 10 to determine whether the order should be made permanent.

The legislative and legal maneuvers aimed to prevent Defense Distributed, a Texas nonprofit organization, from posting the schematics for 3-D-printed guns on the Internet. The firearms, which are mostly made of plastic, are untraceable because they do not have serial numbers, would not require a background check to print and are easily destroyed after use. The available blueprints include guides for making guns akin to assault-style rifles such as AR-15s and AR-10s, a pistol called the Liberator, and a Ruger 10/22.

The Pennsylvania attorney general also sued Defense Distributed on Sunday, and the company agreed to temporarily block Pennsylvania users from its website. Democrats in the House and Senate also filed legislation that would in effect ban guns constructed from 3-D-printed material.

But despite the efforts, some of the plans went online Friday, according to Pennsylvania Attorney General Josh Shapiro. He said about 1,000 people had, within days, already downloaded 3-D plans for AR-15 semiautomatic rifles. Defense Distributed agreed not to upload new files.

In a tweet, President Trump said the guns do not “seem to make much sense.” Trump said he is “looking into” the guns’ availability and said he spoke with the National Rifle Association.

I am looking into 3-D Plastic Guns being sold to the public. Already spoke to NRA, doesn’t seem to make much sense!

Deputy White House press secretary Hogan Gidley told reporters Tuesday that it is illegal to own or make a “wholly plastic gun of any kind,” including on a 3-D printer. Gidley said that the administration supports the law and that it “will continue to look at all options available to us to do what is necessary to protect Americans while also supporting the First and Second Amendments. . . . The President is committed to the safety and security of all Americans and considers this his highest responsibility.”

Chris Cox, executive director of the NRA’s Institute for Legislative Action, said in a statement that many have “wrongly claimed” that 3-D printing will lead to the production and “widespread proliferation” of undetectable plastic guns.

“Regardless of what a person may be able to publish on the Internet, undetectable plastic guns have been illegal for 30 years,” Cox said, noting that federal law makes it “unlawful to manufacture, import, sell, ship, deliver, possess, transfer or receive an undetectable firearm.”

It is legal to make a firearm for personal use without a license, though some — such as those that have short barrels, for example — require a tax payment and advance approval from the Bureau of Alcohol, Tobacco, Firearms and Explosives. It is illegal to make a gun from 10 or more imported parts, and it is illegal to make guns that can’t be detected by metal detectors or X-ray machines.

The battle over the blueprints started in 2013, when Cody Wilson, the founder of Defense Distributed, made the first fully 3-D-printed pistol and posted the design files online. The federal government alleged that violated federal law. Uploading the files, it argued, was tantamount to an illegal export of firearms.

Wilson sued, and the federal government shocked all involved by reversing its position. It settled with Wilson on June 29, agreeing to pay $40,000 in legal fees and exempting the company from the regulations, allowing it to post the blueprints online. His lawyer did not immediately respond to a request for comment on Tuesday night’s ruling.

Twenty-one attorneys general signed a letter asking Secretary of State Mike Pompeo and Attorney General Jeff Sessions to withdraw from the settlement and block the plans from going online.

State Department spokeswoman Heather Nauert said U.S. citizens have been legally able to download the files for years and that the State Department was involved because it controls access to U.S. defense technology.

Wilson has maintained that this is a First Amendment case, claiming that the government’s attempts to block the publication of the information on the Web amounts to prior restraint barred by Supreme Court precedent. Blackman, Wilson’s attorney, compared the state government’s attempts to block his client’s website to the Pentagon Papers case, in which the Nixon administration unsuccessfully tried to stop the New York Times and The Washington Post from publishing the contents of a leaked Vietnam War report.

Nauert said the Justice Department recommended that the case settle because it would probably be lost on First Amendment grounds.

Wilson filed suit against the New Jersey attorney general and the Los Angeles city attorney in recent days, arguing that his case is about “access to information,” not gun regulations.

A group of gun-control groups filed suit trying to block publication of the schematics; their case was thrown out by a federal judge.

Opponents blamed the Trump administration for allowing them to go online.

“.@POTUS has imperiled the lives of untold numbers of innocent children, teachers, religious worshippers, movie-goers, and music lovers, not to mention bystanders. Plastic guns are untraceable, undetectable, and uncontrollable. These inevitable deaths will be on his hands,” said Rep. Jackie Speier (D-Calif.), who was shot five times in the Jonestown massacre in 1978.

Sen. Susan Collins (R-Maine) said she believes that Congress needs to take action on the guns.

“This is a dangerous development, and the idea of allowing terrorists and criminals to be able to manufacture their own firearms using 3-D printers is very serious,” she said.

Correction: An earlier version of this article reported that it is legal to make a firearm for personal use without a license if one makes a tax payment and gets advance approval from the Bureau of Alcohol, Tobacco, Firearms and Explosives. Only some homemade guns require a tax payment and advance approval. The article has been updated.

Content from Allstate This content is paid for by an advertiser and published by WP BrandStudio. The Washington Post newsroom was not involved in the creation of this content. Learn more about WP BrandStudio.