Four years ago, FBI agents in Minnesota brought down an Army veteran and self-described militia leader named Keith Michael Novak, who pleaded guilty to identity theft after a federal investigation found he had sold personal details on dozens of former military colleagues.

But as they scanned Novak's encrypted hard drive, the agents found more than they had bargained for: A large cache of child pornography, which led prosecutors to seek a new indictment before Novak could be released from prison on the original charges.

On Wednesday, a federal appellate panel upheld the 12-year sentence imposed on Novak last year after a federal jury found him guilty in the subsequent child porn case.

Novak first hit the FBI's radar when authorities learned that he had made statements about wanting to bomb a National Security Agency building in Utah, FBI spokesman Jeff Van Nest said. An Army veteran who served in Iraq, Novak was a human intelligence collector for the Minnesota Army National Guard when he met with what he thought was a pair of Utah militia members while he attended training there in 2013.

Novak invited the Utah militia members back to Minnesota to view classified material he said he had stolen from the U.S. military while stationed in Fort Bragg, N.C. The "militia members" turned out to be undercover FBI employees, and the stolen goods included a database of sensitive identifying details for roughly 400 members of Novak's former military unit.

Novak admitted to selling such information on about 98 service members and was sentenced to two years in federal prison in 2013.

According to court records, undercover investigators attended a "military style Field Training Exercise" that Novak led in rural Minnesota. Novak also told the investigators that he was prepared to engage in a firefight with any authorities who tried to arrest him.

"We took all that into account in designing an operational plan to take him into custody," Van Nest said in an interview. "We're looking to answer the ultimate question of ... an individual such as this, what is their intent?"

But later, after the FBI cracked a sophisticated encryption program Novak used to conceal data on a hard drive taken from his Maplewood home, agents also found hundreds of images and videos of child pornography. That led prosecutors to seek a new indictment.

In arguing for a lighter sentence in the child porn conviction last year, a federal defender representing Novak wrote that the government "manipulated the process" to maximize the length of Novak's incarceration.

At trial, Novak testified that he acquired the laptop from a friend while stationed at Fort Bragg and that other soldiers frequently borrowed the computer. Novak argued that someone else created the encrypted cache of child porn images on an external hard drive connected to the laptop. But FBI Special Agent Christopher Crowe testified that he found evidence of Novak using the laptop to view images that were identical to ones found in encrypted folders.

On Wednesday, a panel of Eighth Circuit judges dismissed Novak's argument that Senior U.S. District Judge Richard Kyle should not have instructed jurors that they could find Novak guilty if someone else had stored the child porn on his external hard drive and Novak turned a blind eye to the activity.

A federal defender representing Novak declined to comment on Wednesday's opinion.

Novak did not object to the instruction at trial. Circuit Judge Jane Kelly, in a dissenting opinion, wrote Wednesday that she would have sent the case back to district court in Minnesota for a new trial because the government did not present evidence that Novak deliberately intended to remain ignorant of child porn being on the device.

Novak's attorneys have previously described him as a young man "whose difficult childhood and experiences while deployed in Iraq produced a survivalist worldview and disillusionment that led him to make a bad decision."

In arguing for a strong sentence after the child pornography trial, prosecutors pointed out that, despite having spent nearly two years in prison for his identity theft conviction, Novak asserted that he was "forced" into pleading guilty in that case.

"Clearly two years in federal custody has not rehabilitated him or caused him to become more introspective," a federal prosecutor wrote.

Stephen Montemayor • 612-673-1755

Twitter: @smontemayor