This May 10, 2013, file photo shows a plastic pistol that was completely made on a 3D-printer at a home in Austin, Texas. A coalition of gun-control groups has filed an appeal in federal court seeking to block a recent Trump administration ruling that will allow the publication of blueprints to build a 3D-printed firearm. Credit: Jay Janner/Austin American-Statesman | AP

WASHINGTON — 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 Lasnik granted a temporary restraining order on Tuesday night barring a trove of downloadable information about creating the do-it-yourself weapons.

Eight attorneys general and the District of Columbia argued 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.”

Josh Blackman, an attorney 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.

The legislative and legal maneuvers aimed to prevent Defense Distributed, a Texas nonprofit, 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 like AR-15s and AR-10s, a pistol called “Liberator” and a Ruger 10/22.

The technology could herald an era of DIY guns that can be produced — and amassed — in secret.

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 on 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 Donald Trump said the guns “don’t seem to make much sense.” Trump said he is “looking into” the guns being available and said he spoke with the National Rifle Association.

White House Deputy 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 the administration supports the law and 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 plastic, undetectable 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, a tax payment and advance approval from the Bureau of Alcohol, Tobacco, Firearms and Explosives. It also is illegal 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. Wilson’s attorney, Josh Blackman, 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 likely be lost on First Amendment grounds.

Wilson filed suit against the New Jersey attorney general and 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 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 3D printers is very serious,” she said.

Follow the Bangor Daily News on Facebook for the latest Maine news.