The Alexandria federal courthouse where Sean Duncan was sentenced Friday. (Gerald Martineau/The Washington Post)

When the FBI knocked on his front door in December, Sean Duncan says, he ran out the back carrying a thumb drive full of child pornography. He broke it in half and doused it in cleaning solution.

But in a sign of how strange his criminal case has been, prosecutors say he might be lying in an effort to conceal ties to terrorism or information on the death of his son.

U.S. District Judge Leonie M. Brinkema on Friday sentenced Duncan to 20 years in prison and a lifetime of supervision, the maximum allowed under his plea agreement to charges of obstruction of justice and receipt of child pornography.

The FBI was at the 22-year-old’s Sterling, Va., home that December day because of his interest in radical Islam and the Islamic State, not child pornography. He also remains under investigation by authorities in Pennsylvania after the death of his infant son in June 2017, according to court papers.

Prosecutors in federal court in Alexandria said that in the months before his arrest, Duncan was simultaneously looking up child pornography and information on terrorism. In one instance, they said, he took a sexually explicit photograph of an infant relative while changing her diaper.

“I don’t know which is the more serious of the two,” Brinkema said in court Friday — the crimes against children or the interest in terrorism.

“There’s a huge gap in all the information,” she added, because the contents of the thumb drive were never recovered.

In court papers, prosecutors said Duncan was still probably hiding something.

“The investigators believe that he . . . has withheld important information,” assistant U.S. attorneys Colleen Garcia and Gordon Kromberg wrote.

Defense attorneys said Duncan had, on the contrary, been completely forthcoming with law enforcement and has begun confronting untreated mental health problems and trauma.

“Young, lonely and isolated, he was particularly susceptible to . . . the dark underbelly of the Internet,” public defender Elizabeth Mullin said in court.

But his interest “never resulted in any concrete plan to fight or commit a terrorist attack,” she added, and there is no evidence he shared the pornographic photo he took with anyone.

Duncan was raised in Baltimore, bouncing between what defense attorneys describe as abusive and neglectful homes where he was exposed to lead paint. At 3, they said, he was molested by an older boy. A rare childhood friend died. He spent years looking first at adult and then child pornography online, even though he told a psychologist he felt “repulsed after and while looking at it.”

The summer before his senior year, he discovered Islam, and that year, classmates helped him convert.

While the Muslims he met in school and at his local mosque opposed extremism, Duncan found radicals on social media and began talking to them about joining the Islamic State or committing terrorist attacks.

Defense attorneys argued Duncan was just flirting with radical women because he wanted to see them naked.

“I was a poser,” Duncan wrote in a letter to the court.

In court Friday, Garcia pointed out that at least one Islamic State recruiter Duncan dealt with was a man, and Duncan repeatedly discussed traveling to Syria.

“It was far more than flirtation and boasting,” she said.

Duncan met his actual wife in an Arabic-language class and married her 10 months later, although he was an 18-year-old high school graduate, and she was a doctor 15 years his senior.

His family was disturbed by his conversion and the marriage, and his mother called the FBI to say the couple planned to honeymoon in Turkey.

“Sean was too young to be married and father a child,” his sister wrote in a letter to the court. “Sean is still a kid himself.”

He and his wife were turned away at the airport in Turkey and returned to the United States, after which Duncan changed his phone number and Facebook account.

The couple moved to Pittsburgh when Duncan’s wife got a medical fellowship. At home alone while his wife worked, he immersed himself in extremism and child pornography.

After their 6-month-old son died suddenly, they moved to Northern Virginia. The cause of death was inconclusive, according to the defense, and his wife told police the boy choked on baby formula. Duncan denies any involvement.

Defense attorneys also say Duncan turned away from extremism on his own, telling an undercover FBI informant in August she “should not go” to Syria.

Prosecutors saw in that same conversation reason to take Duncan seriously as a threat, citing his reference to “referrals” that help people join the Islamic State.

“I’m seeking to change and better myself,” Duncan said in court Friday. “I apologize to everybody I’ve hurt.”

He said he understood now “the kids in the pictures are real” and added, “I also renounce ISIS.”