(CNN) Gun-rights activists have reached a settlement with the government that will allow them to post 3-D printable gun plans online starting August 1.

The settlement ends a multi-year legal battle that started when Cody Wilson, who describes himself as a post-left anarchist, posted plans for a 3-D printed handgun he called "The Liberator" in 2013.

The single-shot pistol was made almost entirely out of of ABS plastic -- the same stuff they make Lego bricks out of -- that could be made on a 3-D printer. The only metal parts were the firing pin and a piece of metal included to comply with the Undetectable Firearms Act.

The US State Department told Wilson and his non-profit group Defense Distributed to take down the plans. It said the plans could violate International Traffic in Arms Regulations (ITAR), which regulate the export of defense materials, services and technical data.

Almost all of the pieces of this pistol can be made with a 3D printer.

In essence, officials said someone in another country -- a country the US doesn't sell weapons to -- could download the material and make their own gun.

Wilson complied, but said the files already had been downloaded a million times.

He sued the federal government in 2015.

U.S. requires group to remove 3D gun instructions from its website

The settlement

The settlement, which is dated June 29, says that Wilson and Defense Distributed can publish plans, files and 3-D drawings in any form and exempts them from the export restrictions. The government also agreed to pay almost $40,000 of Wilson's legal fees and to refund some registration fees.

The settlement has not been made public, but Wilson's attorneys provided a copy to CNN.

"We asked for the Moon and we figured the government would reject it, but they didn't want to go to trial," said Alan M. Gottlieb with the Second Amendment Foundation, which helped in the case. "The government fought us all the way and then all of the sudden folded their tent."

Gottlieb said they filed the lawsuit during the Obama administration, but he doesn't think that explains the change of heart.

"These were all career people that we were dealing with. I don't think there was anything political about it," he said.

Avery Gardiner, the co-president of the Brady Campaign to Prevent Gun Violence, said she'd be astonished if the settlement wasn't approved by political appointees.

"We were shocked and disappointed that the Trump administration would make a secret backroom deal with very little notice," Gardiner said. She said she found out about the settlement from a magazine article.

The group has filed a Freedom of Information Act request for emails and other documents related to the settlement.

Josh Blackman, Wilson's attorney, said he wished the settlement signaled a philosophical change.

"They were going to lose this case," Blackman said. "If the government litigated this case and they lost this decision could be used to challenge other kinds of gun control laws."

Cody Wilson test fires the 3D printed Liberator pistol in a video posted in 2013

The implications

Do-it-yourself firearms like The Liberator have been nicknamed "Ghost Guns" because they don't have serial numbers and are untraceable.

Wilson has built a website where people will be able to download The Liberator and digital files for an AR-15 lower receiver, a complete Baretta M9 handgun and other firearms. Users will also be able to share their own designs for guns, magazines and other accessories.

He says the files will be a good resource for builders, even though it's not yet practical for most people to 3-D print most of the guns.

"It's still out of reach for them. We'll get to watch it all develop," Wilson said. "The plans will be here when that moment comes."

For Wilson and his supporters, the ability to build unregulated and untraceable guns will make it much harder, if not impossible for governments to ban them.

Gardiner fears it will make it easier for terrorists and people who are too dangerous to pass criminal background checks to get their hands on guns.

"I think everybody in America ought to be terrified about that."

Opinion: 3-D printed guns are a boon for criminals

The fact that high end 3-D printers are still too expensive for most people doesn't ease her concerns.

"The people who make them will be state actors or well financed criminal cartels who have the ability to execute well organized criminal attacks in the United States and elsewhere," she said.

She said that providing the plans to anyone in the world, who has Internet access is a national security threat.

The Defense Distributed website proclaims that "the age of the downloadable gun formally begins."