John Walker Lindh, the American man who pleaded guilty to fighting for the Taliban after the 9/11 attacks, is slated to be released from prison next month under terms restricting his internet access.

A federal judge in Virginia ordered that Lindh, 38, can't have an internet-capable device without permission from his probation office, can’t view or access extremist or terrorism videos, and must allow the probation office to monitor his internet use.

"Given the rare nature of defendant's crime and his unique personal history and characteristics, the probation officer recently filed a request asking the court to impose additional special conditions of supervised release which will govern defendant's behavior post-confinement," Judge T.S. Ellis III wrote in court papers filed earlier this month.

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

Lindh was sentenced to 20 years in prison in 2002 after he pleaded guilty to supplying services to the Taliban and carrying explosives in commission of a felony. Under the terms of the sentence, his probation will last for three years.

Lindh is scheduled to be released from federal prison in Terre Haute, Indiana, on May 23.

In addition to the internet restrictions, the judge ordered that Lindh can’t communicate with anyone online in any language other than English. Ellis also ruled that Lindh can’t leave the United States without permission of the court, and that he must undergo mental health counseling.

Court filings show that Lindh initially opposed the restrictions but dropped his objections after consulting with a lawyer.

Ellis said that Lindh can seek to modify some or all of the special restrictions if he adjusts well to his supervised release.

Lindh was 20 years old when he was captured during the U.S. invasion of Afghanistan in November 2001.

He was among a group of Taliban detainees who allegedly took part in a violent uprising at a detention compound that same month. The uprising led to the death of Johnny Spann, a CIA agent who was involved in questioning Lindh just prior to the uprising.

When Lindh was indicted, the Department of Justice said that he met personally with Al Qaeda leader Osama Bin Laden and trained at an Al Qaeda camp in Afghanistan prior to the 9/11 attacks. But the government dropped terrorism charges in exchange for his guilty plea.

At his sentencing, Lindh said he went to Afghanistan and joined the Taliban to fight what he saw as the anti-Muslim Northern Alliance and learned later about the Taliban’s close connection to bin Laden. "I want the American people to know that had I realized then what I know now about the Taliban, I never would have joined them," he told the court.

Ellis said there was no evidence that Lindh played any role in Spann’s murder.