John Walker Lindh, the American captured fighting with the Afghan Taliban two months after the 9/11 attacks, is set to be released from prison Thursday amid concerns among U.S. authorities that he remains a potentially violent Islamic extremist, current and former officials told NBC News.

Underscoring those worries is Lindh's 2015 handwritten letter from prison to NBC's Los Angeles station KNBC —revealed for the first time Wednesday — in which he expressed support for ISIS, saying the terror group that beheaded Americans was "doing a spectacular job."

"The Islamic State is clearly very sincere and serious about fulfilling the long-neglected religious obligation to establish a caliphate through armed struggle, which is the only correct method," Lindh wrote.

Lindh expressed that sentiment—in response to a question from the station about whether ISIS represents Islam—after ISIS had beheaded Americans in well-publicized videos, including journalist James Foley in August 2014. It was his third of four letters in a series of correspondence with KNBC.

He did not respond to a follow-up question asking him about ISIS violence, saying in his final letter that he would no longer respond to the reporter's inquiries.

Lindh’s correspondence with journalists and other comments he made in prison formed part of the basis of a 2016 U.S. intelligence document, produced by the National Counter Terrorism Center, saying that he “continued to advocate for global jihad and to write and translate violent extremist texts.”

John Walker Lindh, obtained Jan. 22, 2002 from a record of religious schools where he studied for five months in Bannu, Pakistan. via AP file

A memo making a similar point was circulating among authorities last week, according to a U.S. official who read it.

After serving 17 years of a 20-year sentence, Lindh will be released for good behavior, as is standard in the federal system. Judge T.S. Ellis imposed unusually restrictive conditions on him, including mandatory monitoring of his internet usage, banning him from foreign travel and requiring mental health counseling. A U.S. official told NBC News he would live in Northern Virginia, something his lawyer affirmed to KNTV, the NBC station in the Bay Area.

“It is one of the most restrictive sets of conditions I’ve seen in a terrorism case, and it probably speaks to their concerns about him,” said Seamus Hughes, a former U.S. intelligence official who studies extremism at George Washington University.

Lindh’s lawyer and a representative of his family declined to comment to NBC News.

The conditions of his supervised release last three years, after which Lindh will be clear of formal supervision. U.S. officials told NBC News the FBI is likely to keep a close eye on him. It’s unclear whether authorities would have a legal predicate to obtain a national security warrant to intercept his communications.

Lindh expressed remorse during his 2002 sentencing hearing before Judge T.S. Ellis in Alexandria, Va., saying he did not support terrorism and he made a “mistake by joining the Taliban.”

In his letters to NBC 4 Los Angeles, he expressed markedly different sentiments, saying he was proud “to take part in the Afghan jihad." In the letters, he signed his name as Yahya.

Concerns about Lindh’s extremist views were the subject of a 2017 article in Foreign Policy magazine, but they have not been widely publicized. Many people, including prominent figures, had urged that his sentence be commuted, portraying him as a misguided young man who was caught up in the heightened tensions of the post 9/11 period.

One expert said Lindh would be wise to clarify his views about ISIS.

"John Walker Lindh served his time. Given the support for ISIS expressed in this letter from four years ago, it would be important for Lindh to go on record declaring his intentions to live a peaceful and constructive life and to renounce terrorism and violence," said Karen Greenberg, director of Fordham University’s Center on National Security. "Without that, allegations, confusion and anger will likely continue to surround him."

The conditions of his supervised release don’t satisfy some who are watching the case. Two U.S. senators, Richard C. Shelby, R-Ala., and Maggie Hassan, D-N.H., wrote a letter to the bureau of prisons questioning why Lindh was being released early, and pointing to a lack of government effort to deal with the many convicted terrorists who will be following Lindh to freedom.

“As many as 108 other federal terrorist offenders are scheduled to complete their sentences and be released from U.S. federal prisons over the next few years,” they wrote. “Little information has been made available to the public about who, when and where these offenders will be released, whether they pose an ongoing threat, and what federal agencies are doing to mitigate this threat while the offenders are in federal custody.”

Also disturbed by the release is Johnny Spann, whose son, CIA officer Johnny Micheal Spann, was killed during a prison riot in an Afghan holding facility where Lindh was detained. Judge Ellis said there was no evidence linking Lindh directly to the death.

Spann sent a letter to Ellis asking for an investigation into the intelligence reports about Lindh’s extremism. Spann could not be reached for comment Wednesday.

He told the New York Times: “We’ve got a traitor that was given 20 years and I can’t do anything about it. He was given a 20-year sentence when it should’ve been life in prison.”

Nick Rasmussen, the former director of the National Counter Terrorism Center and an NBC News contributor, said he could not discuss the intelligence about Lindh.

But, he said, “the looming release of John Walker Lindh highlights in the starkest possible way challenges that lie ahead of us in managing the reintegration into society of extremists who finish their prison sentences."

The criminal justice system is well equipped to prosecute and convict terrorists, he said, “but we are much less well postured to carry out successful rehabilitation and de-radicalization programs. That means that convicted terrorism subjects who finish their sentences like John Walker Lindh could very well pose a security problem once they leave prison.”

Lindh converted from Catholicism to Islam as a teenager, leaving his home in California to study Arabic in Yemen. more than three years before the 9/11 terrorist attacks. He traveled Pakistan and later Afghanistan, where he spent time at a Qaeda training camp and briefly met Osama bin Laden, according to court testimony.

He was captured fighting with the Taliban even as the fires were still burning under the wreckage of what once was the World Trade Center. His situation provoked outrage in some quarters and sympathy in others.

His father, Frank Lindh, in 2006 called him “a decent and honorable young man embarked on a spiritual quest who became the focus of the grief and anger of an entire nation over an event in which he had no part.”

But U.S. officials say that in an era when ISIS is encouraging Americans to attack at home by driving trucks into crowds, his comments and writings in prison make him someone they continue to worry about.