After seven years of litigation spanning two appeals, an inadvertently disclosed top-secret document and a shredded banana peel, a case accusing the federal government of illegal wiretapping appears finally to be dead.

The U.S. Court of Appeals for the Ninth Circuit ruled Tuesday that U.S. District Judge Vaughn Walker of San Francisco had erred in awarding summary judgment — and $2.5 million in attorney fees — to the al-Haramain Islamic Foundation and two of its former lawyers for illegal surveillance. Walker’s mistake was ruling that the government had impliedly waived its sovereign immunity under the Foreign Intelligence Surveillance Act, Judge M. Margaret McKeown wrote for a unanimous Ninth Circuit panel.