Updated

John Walker Lindh, the young Californian who became known as the American Taliban after he was captured by U.S. forces in the invasion of Afghanistan in late 2001, is set to go free after nearly two decades in prison.

But conditions imposed recently on Lindh's release, slated for Thursday, make clear that authorities remain concerned about the threat he could pose once free.

Lindh, now 38, converted to Islam as a teenager after seeing the film "Malcolm X" and went overseas to study Arabic and the Quran. In November 2000, he went to Pakistan and from there made his way to Afghanistan. He joined the Taliban and was with them on Sept. 11, 2001, when al-Qaida terrorists attacked the World Trade Center and the Pentagon.

The U.S. attacked Afghanistan after the country failed to turn over al-Qaida leader Osama bin Laden. Lindh was captured in a battle with Northern Alliance fighters in late 2001. He was present when a group of Taliban prisoners launched an attack that killed Johnny Micheal "Mike" Spann, a CIA officer who had been interrogating Lindh and other Taliban prisoners.

Television footage of a bearded, wounded Lindh captured among Taliban fighters created an international sensation, and he was brought to the U.S. to face charges of conspiring to kill Spann and providing support to terrorists. Eventually, he struck a plea bargain in which he admitted illegally providing support to the Taliban but denied a role in Spann's death.

Lindh received a 20-year prison sentence. He served roughly 17 years and five months, including two months when he was in military detention. Federal inmates who exhibit good behavior typically serve 85 percent of their sentence.

His probation officer asked the court to impose additional restrictions on Lindh while he remains on supervised release for the next three years. Lindh initially opposed but eventually acquiesced to the restrictions, which include monitoring software on his internet devices; requiring that his online communications be conducted in English and that he undergo mental health counseling; and forbidding him from possessing or viewing extremist material, holding a passport of any kind or leaving the U.S.

Authorities never specified their rationale for seeking such restrictions. A hearing on the issue was canceled after Lindh agreed to them.

The Bureau of Prisons said Lindh rejected an interview request submitted by The Associated Press, and his lawyer declined to comment. But there have been reports that Lindh's behavior in prison has created cause for concern. Foreign Policy magazine reported in 2017 that an investigation by the National Counterterrorism Center found that Lindh "continued to advocate for global jihad and to write and translate violent extremist texts."

A former inmate who knew Lindh from the time they spent at the same federal prison said he never heard Lindh espouse support for al-Qaida or indicate a risk for violence, but he found Lindh to be anti-social and awkward around others, with an unyielding, black-and-white view of religion. The inmate spoke to The Associated Press on condition of anonymity because he wanted to avoid further stigmatization from his time in Lindh's prison unit.

Michael Jensen, a terrorism researcher at the University of Maryland's National Consortium for the Study of Terrorism and Responses to Terrorism, said it's clear the government has concerns about Lindh's mindset.

"For three years he's going to be watched like a hawk," Jensen said.

He said Lindh represents an interesting test case, as he is on the leading edge of dozens of inmates who were convicted on terror-related offenses in the aftermath of Sept. 11 and are eligible for release in the next five years. He said there's little research to indicate the efficacy of de-radicalizing inmates with connections to radical Islam, but he said the research shows that recidivism rates for those connected to white supremacy and other forms of extremism are high.

Lindh has been housed in Terre Haute, Indiana, with other Muslim inmates convicted on terror-related charges. The rationale was to keep those inmates from radicalizing others in the general prison population, Jensen said. Those inside the unit were supposed to be limited in their ability to communicate with each other.

"But the reality is these guys still talk to each other," he said.

Lindh, for his part, admitted his role and his wrongdoing in supporting the Taliban, but he and his family have bristled at any notion that he should be considered a terrorist. When he was sentenced, Lindh said he never would have joined the Taliban if he fully understood what they were about. He also issued a short essay condemning acts of violence in the name of Islam that kill or harm innocent civilians.

Lindh's time in prison has provided only a few clues about his current outlook. He filed multiple lawsuits, which were largely successful, challenging prison rules he found discriminatory against Muslims. In the more recent lawsuits, he used the name Yahya Lindh. One lawsuit won the right to pray in groups at the prison in Terre Haute. A second lawsuit reversed a policy requiring strip searches for inmates receiving visitors, and a third won the right to wear prison pants above the ankle, which Lindh said is in accordance with Islamic principles.

In the strip-search lawsuit, Lindh offered a discussion of Islamic rules prohibiting exposure of the body. If he's compelled to reveal himself, he said, he's also compelled under his religion to fight the rules requiring him to sin.

Some have criticized Lindh's pending release. In March, the legislature in Alabama, where Spann grew up, adopted a resolution calling it "an insult" to Spann's "heroic legacy and his remaining family members."

In addition, Republican Alabama Sen. Richard Shelby and Democratic New Hampshire Sen. Maggie Hassan wrote a letter last week to the Bureau of Prisons expressing concern.

"We must consider the security and safety implications for our citizens and communities who will receive individuals like John Walker Lindh who continue to openly call for extremist violence," they wrote.

On Monday, Spann's father, Johnny Spann, wrote a letter requesting that Lindh be investigated before he's released, citing the National Counterterrorism Center's investigation as his rationale for concern.