WASHINGTON—A federal judge on Wednesday declared that a terrorism watch list created after the Sept. 11, 2001, attacks is unconstitutional in its current form, reopening the legal debate about a key national security tool used by thousands of U.S. and international government agencies.

U.S. District Judge Anthony Trenga ruled that the Terrorist Screening Database, which is maintained by the Federal Bureau of Investigation and several other government agencies, doesn’t give Americans on the list an adequate opportunity to challenge their status as potential terrorism suspects.

The lawsuit was filed in Virginia federal court in 2016 by the nonprofit Council on American-Islamic Relations, or CAIR, on behalf of nearly two dozen Americans who believe they are included in the database.

Judge Trenga ruled that the plaintiffs “have constitutionally protected liberty interests” that are implicated by the government maintaining such a database and that the current process for challenging their inclusion on the list is inadequate.

“There is no evidence, or contention, that any of these plaintiffs satisfy the definition of a ‘known terrorist,’” Judge Trenga wrote.