A federal judge on Tuesday threw out a lawsuit filed by a former Guantánamo detainee who was repatriated to Afghanistan in December 2014 but has continued to seek a judicial ruling clearing him of accusations that he was linked to terrorism.

The case was notable for two reasons. First, the former detainee, Shawali Khan, is no longer in custody but has pursued his habeas corpus lawsuit because he said the allegations that he had connections to a terrorist group have left a cloud over his life.

Second, at an earlier stage in the lawsuit, while Khan was detained at the U.S. naval base in Guantánamo Bay, Cuba, the government introduced evidence against him that it kept secret at the time from his lawyers. While the courts upheld his detention on that basis, the government apparently later changed its mind about the credibility of that evidence, the details of which have not been disclosed.

In 2014, court documents showed, officials provided unspecified information to Khan’s defense team, which cited it in asking Judge John D. Bates of the U.S. District Court of the District of Columbia to reopen the case. The government then transferred Khan. But his lawyers pressed forward, asking the judge to rule that Khan had never been lawfully detained in the first place, to “correct a substantial injustice” related to the previously withheld information.

On Tuesday, Bates said that while he was sympathetic to Khan, he agreed with the Justice Department that the case was moot because Khan was no longer in U.S. custody. He cited a 2011 appeals court ruling finding that factors like reputational harm were not enough to keep such a case active for a former detainee.

Bates noted that more was known now than in 2011 about the effects of detention on those eventually released, citing two recent New York Times articles about the challenges faced by former detainees. But, he said, the 2011 precedent still controlled the legal issue.

In court filings, Khan raised several arguments. Among them, he said that the Afghan government had seized his lands after he was captured in 2002, and a ruling that he was innocent might help him get the deeds back.

He also said that because of his past, he could not obtain a passport, which he needed to travel to a medical clinic in India for treatment for hearing loss he suffered as a result of “loud blaring music” used “during interrogations, mostly at CIA facilities before” he was sent to Guantánamo.

But Bates noted that it was the Afghan government, not the U.S. government, that would decide whether to return the lands or issue him a passport.

Assuming that Khan’s statements were accurate, Bates wrote, “the court is sympathetic to the pickle” in which he found himself.

“He is unable to receive medical treatment for injuries allegedly sustained while in U.S. custody because of his history of being held in U.S. custody,” the judge wrote. “However, this injury is not redressable by a federal court.”