The privacy network Tor is being targeted by the National Security Agency (NSA), according to files leaked to members of the project.

The investigation alleges that those searching for privacy tools were also tracked by the American spy agency’s XKeyscore programme, alongside democracy advocates using a Tor network funded by the US government.

Tor said: "Tor has gone mainstream in the past few years, and its wide diversity of users – from civic-minded individuals and ordinary consumers to activists, law enforcement, and companies – is part of its security.

"Just learning that somebody visited the Tor or Tails website doesn’t tell you whether that person is a journalist’s source, someone concerned that her Internet Service Provider will learn about her health conditions, or just someone irked that cat videos are blocked in her location."

Tails is a bootable Linux OS that leaves no trace of its usage on a computer unless the user authorises it to, as well as encrypting files and communications through the Tor network.

The privacy network speculated that the activities of the NSA might "violate the wiretap act".

The NSA denied that any of its activities were illegal, claiming that it complied with the a newly signed directive from President Barack Obama which affirms the privacy interests of individuals and in theory curtails spy agencies.

"XKEYSCORE is an analytic tool that is used as a part of NSA’s lawful foreign signals intelligence collection system," the NSA said in a statement. "Such tools have stringent oversight and compliance mechanisms built in at several levels.

"The use of XKEYSCORE allows the agency to help defend the nation and protect US and allied troops abroad."

Members of Tor worked alongside German broadcasters NDR and WDR to analyse the documents and determine who was at risk of being tracked by the spy agency.