Three years ago, Keith Gartenlaub was living a seemingly normal life in southern California. He had a high-paying job as a senior engineer with Boeing, where he had worked for 20 years. His wife ran an art gallery and dabbled in real estate. Once in a while, they were able to visit her elderly parents in Shanghai, and they even bought property there.

Today, that life has been destroyed. The 47-year-old is under house arrest, with an electronic monitoring device on his ankle. He’s not allowed to have a computer—or anything else that could give him access to the internet, even a PlayStation 3. He has to submit a drug test three times a month and give his court supervisors two hours’ notice to go to the local Starbucks. He and his wife are living on borrowed money.

All this because an FBI agent read a magazine article saying Chinese intelligence might have a spy at Boeing and began poking around. He noted Gartenlaub’s wife was born in China and picked up some company grousing about their regular trips there. With a secret warrant from the Foreign Intelligence Surveillance Court, the bureau obtained records of their telephone calls, emails and bank records and broke into their house to copy their computer hard drives. After a 21-month investigation, which included following them around, the FBI could not make an espionage case against Gartenlaub. But it did find something else: child porn on his computer.

The odd thing is that there is no definitive proof Gartenlaub, a computer systems specialist, ever viewed the pictures. Nor is there any evidence he ever traded in pornography, took photos or videos of children or chatted about his collection of photos online—common practices among paedophiles.

But the porno files gave prosecutors a cudgel: “They said if I helped them on Chinese espionage, they could make the pornography thing go away,” recalls Gartenlaub, who heatedly denies any interest in child pornography. “I told them I’d like to help but I didn’t know anything about Chinese espionage!” Thom Mrozek, spokesman for the US Attorney’s office in Los Angeles, declined to comment on Gartenlaub’s assertion, which was backed up by three others in his camp.

When it was reported that the blueprints for the Boeing C-17 may have been stolen, Gartenlaub came under suspicion

Prosecutors could have walked away at that point. Instead, they now decided they could not ignore “evidence of a serious crime” and pressed charges of receipt and possession of child pornography. In court last December, in a shock to Gartenlaub and his lawyers, a jury served up guilty verdicts that carried a sentence of up to 10 years in prison. It was an outcome so troubling to the judge who presided over the case that she said she’s considering dropping one charge and may well toss out the other.

Even if the judge allows him to shed his ankle bracelet, however, Gartenlaub will never truly walk free. He’s effectively lost his security clearance and any chance of working in the defence industry again. His nightmarish experience should worry any American, says Karen Greenberg, director of the Centre on National Security at Fordham University’s School of Law — especially the 4.5 million US citizens who hold security clearances. “The most upsetting thing” about the case, she says, “is the question: ‘Did evidence get planted?’” With so much of the case wrapped in secrecy, she adds, it’s “a disturbing possibility.”

Jeff Fischback, a noted computer forensics expert who examined Gartenlaub’s hard drives for the defence and concluded the porno files hadn’t been viewed, agrees. “The important question about this case,” he says, “is why go after this guy so hard. Why go after this guy so aggressively? What I suspect … is that this was more about a failed national security investigation.”

The Gartenlaub case was just the latest government stumble in some of its most-ballyhooed prosecutions of alleged Chinese spies. In recent months, the Justice Department has been forced to drop charges against a former National Weather Service hydrologist and the head of the physics department at Temple University—in each case because the government misinterpreted their communications with people in China.

But facing “an onslaught,” as The New York Times recently put it, of Chinese espionage, it’s easy to understand how the FBI would jump at the slightest hint of suspicious behaviour. According to an affidavit in the Gartenlaub case, the government has prosecuted about 45 cases involving outright spying, illegal technology transfers and massive covert infiltration of US government computers, among other things. In the most brazen case on record, the Obama administration accused Beijing in 2015 of hacking into US government files and stealing the personal data on 21 million Americans, including their fingerprints and Social Security numbers. Chinese probes of US industrial, technical and military targets have been constant, intelligence officials say. Someone in China hacked into the home computer of a former top lawyer for the FBI, says one.

To the FBI, it must seem like Chinese spies are everywhere. And in many cases, its targets, right or wrongly, have been Chinese-American. Peter Zeidenberg, a former prosecutor who represented the Temple University physicist and National Weather Service hydrologist, says the government may be giving in to racial profiling in its frantic search for spies. “I think prosecutors are feeling pressure to bring these cases,” Zeidenberg recently told the TV news show 60 Minutes. “I think investigators are excited about bringing cases that may be high-profile.” Recognising that the federal investigators had a problem, Deputy Attorney General Sally Yates has implemented tighter controls over spying cases involving Chinese-Americans.

But in 2013, it would’ve been hard to find a higher-profile case than a possible spy inside Boeing, a prime government contractor. After China unveiled its giant Y-20 transport plane, Wired magazine reported that “Beijing may also have acquired some of the C-17’s blueprints from a spy working at Boeing”. And in the FBI’s thinking, Gartenlaub had the access and means to steal those blueprints for China.

As it turned out, Beijing did have a spy trying to steal the C-17’s blueprints. In July 2014, Su Bin, a China-based businessman, was arrested in Canada and charged with conspiring with two unnamed Chinese hackers to steal secrets about the C-17, as well as the F-22 and F-35 warplanes made by Lockheed Martin. The FBI, according to court papers reviewed by the Associated Press, took notice of the case and began to look for Su’s accomplices. Eventually, it homed in on Gartenlaub.

In March, Su Bin pleaded guilty to charges of conspiring to steal sensitive military aircraft data

“They triangulated Keith as the guy at Boeing who would have been Su Bin’s inside source,” according to Gartenlaub’s attorney, Mark Werksman. Gartenlaub calls the FBI’s suspicions “ridiculous”, adding, “I’ve been a good Boeing employee for years. Just because I married somebody from China doesn’t mean I’m going to betray my country. If they think I’m a spy, then charge me with it.”

The lack of an indictment suggests the bureau couldn’t make a spy case. But it did have the pornography files, which it was able to view in secret with the Foreign Intelligence Surveillance Act (FISA) court’s authorisation for an espionage investigation and then obtain with a criminal warrant.

This manoeuvre, permissible under post-9/11 legislation, disturbs civil liberties advocates. Greenberg, whose latest book, Rogue Justice: The Making of the National Security State, was published in May, reports that “using a FISA warrant in an espionage or terrorism case and then finding another crime” is “not unusual.” And it gives the government tremendous power over defendants: because the FISA warrant in Gartenlaub’s case remains classified, he cannot examine whether the FBI had probable cause to hunt for the pornography seized from his computer—or whether anyone tampered with those files.

The government’s attitude is “trust us,” says Werksman. “Trust us that we had a legitimate reason to go there on the FISA warrant, and once we saw the kiddie porn, now you have to take our word for it that [the warrant] was lawful in the first place.”

“Everyone in this country should be pissed off about this,” Greenberg says. “It can happen to you. It can happen to anyone.”