FBI agents investigating a potential data leak on Boeing’s C-17 jet obtained a secret warrant to search the home computers of a company manager for evidence they hoped would connect him to Chinese economic espionage. The jet was built in Long Beach until last year.

Instead, they say, they found something else entirely: graphic child pornography.

With that discovery two years ago, an investigation of sensational but ultimately unproven allegations of espionage veered into an unrelated child pornography prosecution that resulted in Lake Elsinore resident Keith Gartenlaub’s conviction in December.

Now, the Los Angeles case is testing a defendant’s ability to access information about himself presented to the country’s secretive foreign intelligence court, which issued the warrant that let agents scour his hard drives.

At issue is how the government uses evidence derived through the Foreign Intelligence Surveillance Court and under what circumstances that information should be made available to defendants, particularly when it winds up repurposed for a routine criminal prosecution that has nothing to do with national security.

Gartenlaub says he has a right to know the government’s arguments that were used to obtain the warrant, and fight them. “You can’t base a search on lies,” the 48-year-old said in an interview with The Associated Press.

He’s seeking a new trial as he awaits his April 18 sentencing, saying there’s no evidence he was aware of the child pornography or had ever accessed the images. If that’s denied, he’s likely to appeal on grounds that the warrant to inspect his computers was based on mistaken assumptions and allegations of a crime, espionage, for which he’s never been charged.

It won’t be an easy argument. His request to suppress pornography evidence that he said was improperly obtained was denied before the trial. And he’s tried to review the sealed FISA court records in hopes of attacking the FBI search, but the government refused to provide the information and a judge said he wasn’t entitled to it.

“I don’t want the FISA warrant for my own personal edification. I need to know whether they provided probable cause to a judge to search a man’s computers and home,” said his attorney Mark Werksman.

The FISA court was created in 1978 to hear government surveillance requests in foreign intelligence matters, and it remains shrouded in secrecy. Though judges can order prosecutors to share FISA information with defendants if they deem it necessary for challenging a search’s legality, courts have consistently sided with the government in saying that disclosing the material could expose sensitive intelligence secrets. In Gartenlaub’s case, then-Attorney General Eric Holder submitted a declaration advising against disclosure.

A rare exception came in 2014, when a judge in Chicago ordered the disclosure of FISA materials in a bomb-plot case. A federal appeals court overturned the decision, and the Supreme Court declined to review the matter.

“For defendants, access to this information is a matter of fundamental fairness, because without it they cannot meaningfully challenge whether the government’s secret searches were lawful in the first place,” American Civil Liberties Union lawyer Patrick Toomey said in an email. “For the public, this information is crucial because it is the only way to know whether the law’s basic protections for Americans have been watered down in practice, behind closed doors.”

The Justice Department noted that the judge, Christina Snyder, already ruled that the FISA warrant was lawfully issued and that the evidence was gathered properly.

“When law enforcement lawfully obtains evidence of a serious crime, in this case a crime against children, we will pursue further investigation of that crime,” the department said in a statement.

The FBI interviewed Gartenlaub in 2013 after a Wired.com article revealed a resemblance between a new Chinese aircraft, the Xian Y-20, and the Boeing C-17, a military cargo plane, and suggested someone within Boeing may be responsible.

An FBI affidavit that sought permission to search his Yahoo email account outlines the basis for suspicion, describing Gartenlaub as the “one engineer” who had access to C-17 data, intimate knowledge of Boeing’s computer systems and family ties to China. He is married to a Chinese national whose family he described as “well connected,” traveled regularly to the country and expressed frustration that Boeing sought to limit his excursions there over security concerns, the affidavit says. The FBI also focused on dozens of deposits to the couple’s bank account that it deemed suspicious.

A recent court filing obliquely suggested a connection to the prosecution of Su Bin, a Chinese businessman who pleaded guilty last month for his role in a Boeing hack that led to the theft of C-17 secrets.

Gartenlaub, for his part, maintains he wasn’t working on the C-17 program when the Su Bin theft is thought to have occurred and didn’t have access to the data in the first place — though, he says, thousands of other Boeing employees did.

The FBI accessed his computer servers in 2014 after obtaining a FISA warrant. Though Gartenlaub acknowledges the information presented to the court likely mirrors the FBI affidavit, he says there’s no way to know for sure without seeing the warrant application.

In its search the FBI says it found images of prepubescent girls on hard drives, and evidence that Gartenlaub maintained a “carefully curated and organized collection” that was copied multiple times.

But a forensic examiner who reviewed the evidence for the defense said the images were intermingled in extensive folders with files from other computer users, raising the possibility someone else was responsible for the pornography. Defense lawyers say there was no proof the images were opened in the years since they’d been downloaded.

“Either I’m this spy-slash-child pornographer, or I’m one of them, or I’m none of them,” Gartenlaub said. “I’m telling you, I’m none of them.”

Meanwhile, prosecutors have recommended a 10-year prison term. “Defendant,” they wrote in a recent filing, “continues to deny any personal responsibility for his crimes of conviction.”