For more than a year, Joseph Roh illegally manufactured AR-15-style rifles in a warehouse south of Los Angeles.

His customers, more than two dozen of whom were legally prohibited from possessing a firearm, could push a button, pull a lever, and walk away a short time later with a fully assembled, untraceable semi-automatic weapon for about $1,000, according to court records.

Roh continued his black-market operation despite being warned in person by agents from the Bureau of Alcohol, Tobacco, Firearms and Explosives that he was breaking the law.

But five years after raiding his business and indicting him, federal authorities quietly cut a deal with Roh earlier this year and agreed to drop the charges.

Why?

The judge in the case had issued a tentative order that, in the eyes of prosecutors, threatened to upend the decades-old Gun Control Act and "seriously undermine the ATF's ability to trace and regulate firearms nationwide."

A case once touted by prosecutors as a crackdown on an illicit firearms factory was suddenly seen as having the potential to pave the way to unfettered access to one of the most demonized guns in America.

Federal authorities preferred to let Roh go free rather than have the ruling become final and potentially create case law that could have a crippling effect on the enforcement of gun laws, several sources familiar with the matter told CNN. Each requested anonymity due to the sensitive nature of the case and its possible implications.

Under US District Court Judge James V. Selna's interpretation of the law, convicted felons and other people prohibited from possessing firearms would be allowed to legally acquire all the parts necessary to assemble an AR-15-style rifle and other weapons, according to federal prosecutors.

Prosecutors and ATF officials declined comment for this story, noting that the case against Roh is technically an open matter because he remains subject to a deferred prosecution agreement.

Adam Winkler, a UCLA constitutional law professor and Second Amendment expert, predicted that Selna's tentative order would have "broad implications" and would encourage others to challenge existing law.

"This case could open up a huge loophole in federal law" he said. "It could lead to an explosion in the number of AR-15s out on the streets."

AR-15-style weapons are among the most popular in America and have been used in numerous mass shootings in recent years, including those at an elementary school in Connecticut, an outdoor music festival in Las Vegas, a church in Texas, and a high school in Florida.

The guns are sometimes assembled from separately acquired parts. Under federal law, the one regulated individual part of a firearm is what's known as the frame or receiver — a piece that, among other things, provides a housing for the hammer and firing mechanism of a gun.

Though incapable of firing a round, the part is considered a gun in its own right and is subject to the same restrictions as a fully intact firearm. Manufacturers must stamp it with a serial number and licensed dealers are required to conduct background checks on prospective buyers. The restrictions are intended, in part, to keep felons and other people prohibited from possessing firearms from acquiring them piece by piece.

AR-15s, however, do not have a single receiver that meets that definition. They have both an upper and lower receiver — two parts as opposed to the single part described in the law.

At issue in Roh's case was whether the law could fairly be interpreted to apply to just the lower receiver of the AR-15, as the ATF has been doing for decades.

To rule otherwise "would sweep aside more than 50 years of the ATF's regulation of AR-15s and other semiautomatic firearms," prosecutors wrote prior to the judge's order.

Federal law enforcement officials — and members of Congress — have been on notice about a potential problem with the language in federal gun law as applied to AR-15s since at least 2016.

In July of that year, prosecutors in Northern California abandoned a case against a convicted felon named Alejandro Jimenez after a judge found that the AR-15 lower receiver he was accused of purchasing in an ATF undercover sting did not meet the definition of a receiver under the law.

The ruling and subsequent dismissal drew little notice but prompted a letter to Congress from then-US Attorney General Loretta Lynch. She advised lawmakers that the judge's decision was not suitable for appeal and that if ATF officials believed the definition should be changed, they should pursue regulatory or administrative action.

'Not firearms'

Roh, who called his company ROHG Industries, had been on the ATF's radar since at least 2012, according to court records.

He met that summer with agency representatives about selling unfinished lower receivers, often referred to in the gun world as "80% lowers" because they are roughly 80% complete.

The part, which surrounds the trigger area of an AR-15, requires some additional machining and drilling before it is considered a regulated firearm under the law.

Roh sent the ATF a sample of one of his unfinished lower receivers seeking a determination as to whether it constituted a firearm. He was advised that it did not.

The devices are controversial among law enforcement and gun control advocates because they can be bought and sold without restriction, but can be converted into finished lower receivers, and then a fully functioning weapon, with relative ease.

"A violent shooting spree'

That is precisely how authorities suspect that John Zawahri obtained the AR-15-style rifle he used in a fatal shooting spree in Santa Monica, California, in 2013, according to confidential ATF documents obtained by CNN.

The documents state that the un-serialized matte black rifle Zawahri used to carry out the attack "appears to have been manufactured from an 80% lower receiver."

The documents note that investigators recovered a ROHG Industries invoice for an 80% lower receiver in Zawahri's residence after he was killed by police.

Agents suspect Zawahri finished machining the device on his own and then purchased the remaining unregulated parts to assemble a complete rifle.

"The ease in which the 80% lower can be acquired and manufactured into a complete firearm, as well as the anonymity in manufacturing and possessing such a weapon, makes it an option for people prohibited from purchasing a firearm through normal legal channels" the ATF documents state.

According to Santa Monica police, investigators found a letter from the Department of Justice in Zawahri's bedroom that was drafted two years before the attack, informing him that he was not eligible to purchase a firearm. A police department news release did not specify whether the letter was from the US or California Department of Justice. Nor did it provide a reason for why Zawahri was prohibited from buying a gun.

CNN was unable to determine whether ATF agents interviewed Roh about Zawahri's purchase.

Roh declined comment through his attorney, Gregory Nicolaysen.

Nicolaysen said any suggestion of a link between Roh's business and the Santa Monica shooting was based on "innuendo, not evidence."

"There is no credible evidence linking my client to any mass shooting," he said.

About four months after the shooting in Santa Monica, ROHG Industries turned up in an ATF investigation again — this time a half dozen un-serialized AR-15-style rifles were seized as part of a drug probe near San Bernardino, California. An informant in the case said the guns came from Roh's factory, according to court records.

'Build parties'

Around that same time, Roh sent a letter to the ATF. He had graduated from simply selling unfinished lower receivers and embarked on a new venture.

"We here at ROHG Industries have been doing build parties for quite some time," he wrote in the sparsely worded, one-paragraph letter.

"The customer installs the part into our machine and pushes the start button," Roh explained.

"Is this legal?" he asked.

In November, the chief of ATF's Firearms Technology Branch responded to Roh by letter. He told him that if the "build parties" he was referring to resulted in the production of anything the ATF classified as a firearm, he would need to obtain a license for manufacturing.

Roh did not heed that advice. When an undercover ATF agent visited his factory on two occasions in December, he "observed parts and machinery used to manufacture AR-15-type firearms," court documents state.

Two days before Christmas, the ATF gave Roh a warning in the form of a "cease and desist" letter. It informed him that he was engaged in the unlicensed manufacture of firearms and was at risk of criminal prosecution.

This time, Roh appeared to take heed.

When undercover agents visited his factory in early January, he was not there. But employees told agents they were no longer machining gun parts.

"The ATF had shut them down," the employees said, according to a report recounting the conversation.

They promised to call the purported customers back when they got the "green light" to resume operations.

'Push the green button'

Less than a week later they got the call. Their visit to the factory the following day was captured in secretly recorded video obtained by CNN.

Roh, dressed in a T-shirt and New York Yankees baseball cap, appeared congenial and knowledgeable about firearms. He made no secret of his business model.

"Are you here to ... make yourself a rifle right now?" he asked the agents during the encounter in January 2014.

"I'm not going to get into trouble or anything like that?" one of the agents asked.

"No," Roh reassured him. "We're legal, man."

Roh told the undercover agents he'd enacted a new policy after being shut down by the ATF: Anyone who wanted machining services performed had to pay a $25 fee to join his "gun club." That way, he was no longer catering to the general public, he explained.

He told one of the agents he was already considered a member because he'd bought a gun before. Roh told him he would have to vouch for the newcomer so that he could join the gun club as well.

After collecting $25 from the new customer and agreeing to a price of $1,000 each for a pair of rifles he wanted to buy, Roh directed an employee to begin the machining process.

Moments later, he stood next to the agent in front of a large piece of equipment that is computer-coded to precisely machine parts for AR-15-style firearms.

"Go ahead and press the green button," Roh told the undercover agent.

"The green button?" the agent asked.

"Yeah," Roh replied. "That basically means that you did it — believe it or not."

A member of Roh's staff then oversaw the process of machining and drilling that converted an unfinished lower receiver — an innocuous chunk of metal before the process began — into a finished receiver the ATF considered a firearm under the law.

Roh then added barrels, stocks, bolts, triggers and other parts to make them fully-functioning weapons.

A factory, firearms and convicted felons

When agents served a search warrant on Roh's warehouse factory a month later, they seized dozens of completed handguns and rifles, and hundreds of gun parts, including upper and lower receivers.

His customers, according to records seized in the search, included 19 convicted felons, six domestic abusers, and one person prohibited from possessing guns "due to mental health unfitness." One customer, who had a felony conviction for making terrorist threats, later admitted to buying guns and gun parts from Roh that he then trafficked in Mexico, according to court records.

Roh was charged in October 2014 with manufacturing and dealing in firearms without a license. He pleaded not guilty and opted for a bench trial at which a judge alone would hear the evidence and decide his fate.

Though few facts were in dispute, the case dragged on for years.

It boiled down to a high-stakes legal battle over the definition of a firearm.

A four-year wait, a four-day trial

When the case finally came to trial last year, much of the four-day proceeding consisted of Nicolaysen, Roh's defense attorney, grilling ATF officials on arcane gun laws and regulations and the agency's internal decision-making process.

After both sides presented their evidence, the defense filed a motion for acquittal, arguing that the government's case against Roh was "legally flawed" because the charges were based on a violation of an internal ATF "classification" as opposed to federal law.

Nicolaysen argued that the definition of a receiver under the relevant federal code differed in various ways from the AR-15 component Roh was accused of manufacturing.

Under the US Code of Federal Regulations, a firearm frame or receiver is defined as: "That part of a firearm which provides housing for the hammer, bolt or breechblock, and firing mechanism, and which is usually threaded at its forward portion to receive the barrel."

The lower receiver in Roh's case does not have a bolt or breechblock and is not threaded to receive the barrel, Nicolaysen noted.

He called the decision to classify it as a firearm nonetheless, the result of "secret, in-house decision-making."

Nicolaysen accused the ATF of abusing its authority by pursuing Roh based on his alleged violation of a policy "that masquerades as law."

He asked the judge to consider recommending that then-US Attorney General Jeff Sessions conduct a review to determine whether there were any similar cases pending around the country or past convictions "sustained on the basis of ATF policy, rather than law."

Prosecutors acknowledged there were technical differences between the regulation and the lower receiver in Roh's case, but said the ATF's interpretation of the regulation was consistent with the intent of federal gun laws. The agency's reading of the law "should also receive deference from this court," prosecutors Shawn J. Nelson and Benjamin D. Lichtman argued.

Adopting the defense position, the prosecutors wrote, would be "manifestly incompatible" with the intent of the federal Gun Control Act and would "severely frustrate" enforcement of the law.

The prosecutors' filing said a ruling in favor of the defense could impact the receivers for up to 90% of the firearms in America.

"The necessary result of this would be that the unregulated parts could be manufactured, sold, and combined with other commercially available parts to create completed, un-serialized firearms which would not be subject to background checks, and which would be untraceable," the prosecutors wrote. "Defendant's interpretation would mean that nearly every semi-automatic firearm could be purchased piece by piece with no regulation or background check before a prohibited person would have a firearm."

'There is a disconnect'

Though the trial lasted less than a week, Selna deliberated for more than year. In April, he issued a tentative order in which he determined that the ATF had improperly classified the AR-15 lower receivers in Roh's case as firearms.

He rejected the prosecution's argument that the ATF's interpretation of the regulation describing a receiver could reasonably be applied to the device at issue in Roh's case.

"There is a disconnect," the judge wrote.

Selna added that the combination of the federal law and regulation governing the manufacturing of receivers is "unconstitutionally vague" as applied in the case against Roh.

"No reasonable person would understand that a part constitutes a receiver where it lacks the components specified in the regulation," Selna wrote.

Therefore, the judge determined, "Roh did not violate the law by manufacturing receivers."

The judge's tentative order also found that the ATF's in-house classification process failed to comply with federal rule-making procedures. Changes to substantive federal regulations typically include a notice-and-comment period and eventual publication in the Federal Register.

Selna did find that Roh was guilty of selling completed firearms without a license, subjecting him to a possible prison sentence.

Following Selna's tentative order, the prosecution and defense agreed to a deal in which Roh would plead guilty to the charge against him, but would be allowed to withdraw that plea if he stayed out of trouble for a year. Prosecutors would then dismiss the case. If Roh abides by the deal, he will have no criminal conviction and serve no time behind bars.

Sources familiar with the agreement said prosecutors wanted to strike a deal in order to prevent Selna's order from becoming permanent, drawing publicity, and creating case law that could hamper ATF enforcement efforts.

Roh accepted the deal to avoid a permanent conviction — and possible prison time — for dealing firearms without a license.

Nicolaysen declined to comment on the details of Roh's alleged activities, citing his pending diversion agreement.

But he said his client has left his firearms-related business behind and now deals in industrial vacuums.

Despite Roh's departure from the gun trade, the lawyer said, the issues surrounding his alleged practices remain.

"AR-15s, as we speak today, do not have a receiver by the definition of the existing law and that's a huge issue," he said. "It shows that the laws are obsolete and they're out of sync with the realities of today's firearms market."

Winkler, the UCLA law professor, offered a similar assessment.

When he was first informed of the judge's tentative order by a CNN reporter, Winkler said, "I thought the logic was crazy."

But after reviewing the order and several filings in the case at the request of CNN, he said Selna's rationale appeared legally sound.

"It does seem like there is problem," Winkler said.

Curt Devine, Drew Griffin and Collette Richards contributed to this report.

Stay Informed