SALT LAKE CITY — A former top spy agency official who was the target of a government leak investigation says the National Security Agency conducted blanket surveillance in Salt Lake City during the 2002 Winter Olympics, according to court documents.

Ex-NSA official Thomas Drake wrote in a declaration released Friday that the agency collected and stored virtually all electronic communications going into or out of the Salt Lake area, including the contents of emails and text messages.

"Officials in the NSA and FBI viewed the Salt Lake Olympics Field Op as a golden opportunity to bring together resources from both agencies to experiment with and fine tune a new scale of mass surveillance," Drake wrote.

It comes as part of a lawsuit filed by attorney Rocky Anderson, who was the mayor of Salt Lake City during the Games held a few months after the Sept. 11, 2001, attacks. Anderson said the document was disclosed to the U.S. Department of Justice on Wednesday.

Former CIA and NSA director Michael Hayden has denied in court documents that such a program existed. Hayden was NSA director from 1999 to 2005.

Current NSA operations director Wayne Murphy said in court documents that NSA surveillance in Salt Lake City was limited to international communications in which at least one participant was reasonably believed to be associated with foreign terrorist groups.

Drake disputed that statement, writing that he spoke with colleagues who worked on the operation and were concerned about its legality. He said he also saw documents showing surveillance equipment being directed to the Utah program.

Drake's declaration was written in support of the former mayor's lawsuit. Anderson said the lawsuit is designed to get more information about what he calls covert, illegal operations.

The NSA has argued the lawsuit's claims are far-fetched speculation about a program that may never have existed. A judge, though, refused a Justice Department push to dismiss the lawsuit in January.

Drake started working for the NSA in 2001 and blew the whistle on what he saw as a wasteful and invasive program. He was later prosecuted for keeping classified information. Most of the charges were dropped before trial in 2011, and he was sentenced to one year of probation.