Tech firms whose user data was harvested by NSA spies knew what the spy agency was doing, it has claimed.

Companies including Google, Yahoo, Apple, Microsoft and Facebook knew all about PRISM, the NSA’s internet data collection programme, and helped collect user data for the US government agency, its top lawyer told the government’s privacy watchdog this week.

These claims had been rejected earlier by the firms mentioned, but NSA general counsel Rajesh De claimed that harvesting of communications content and related metadata by the agency was done with the "full knowledge and assistance of any company from which information is obtained".

"PRISM was an internal government term that, as the result of leaks, became the public term," De was quoted as saying by the Guardian.

"Collection under this program was a compulsory legal process, that any recipient company would receive."

Citing greater risks to privacy, De noted that the agency is not allowed to search for US citizens’ data from communications taken directly off the web.

De also added that the same knowledge and related legal processes are also applied when NSA collects communications data in transit across the internet, but not directly from companies, under Section 702.

The revelations about PRISM by ex-NSA contractor Edward Snowden lifted the curtain on the NSA’s spying activities, with tech majors who have battled for increased transparency concerning data requests and increased security measures.

Opposing Snowden’s revelations that the NSA obtains data as it moves between Yahoo and Google data centres, De argued that it is an activity reportedly executed under an executive order called 12333, not under Section 702.

"All 702 collection is pursuant to court directives, so they have to know," De added.