The National Security Agency (NSA) headquarters building in Fort Meade, Maryland (Reuters)

Internet giants Facebook, Google and Yahoo have reacted sharply to media allegations that the firms have been providing the US National Security Agency with user data.

All three companies have issued strong denials they have been part of the covert spy programme Prism, whose existence came to light last week.

Reports based on the leaked documents, carried by the Washington Post and the Guardian, suggest that at least nine internet service providers were part of the NSA's Prism programme.

"Facebook is not and has never been part of any programme to give the US or any other government direct access to our servers," wrote the founder of Facebook, Mark Zuckerberg, and added that the latest media reports are "outrageous".

Google's chief Larry Page wrote in a blog: "We provide user data to governments only in accordance with the law. Our legal team reviews each and every request, and frequently pushes back when requests are overly broad or don't follow the correct process."

Yahoo has also issued a denial, saying the company does not "voluntarily disclose user information [but] the disclosures that occur are in response to specific demands".

According to people involved in the negotiations between the firms and the government quoted by the New York Times all the companies, except Twitter, have cooperated with intelligence officials "at least a bit".

The Obama administration has been pushed on the defensive by the recent leaks and has tried to play down the developments.

Lashing out at the media reports, James R Clapper, the Director of National Intelligence, said: "Over the last week we have seen reckless disclosures of intelligence community measures used to keep Americans safe. In a rush to publish, media outlets have not given the full context-including the extent to which these programs are overseen by all three branches of government-to these effective tools."

Clapper insisted that the surveillance programme reported by the media outlets was "lawful" and "authorised by Congress".

He added: "There are significant misimpressions that have resulted from the recent articles. Not all the inaccuracies can be corrected without further revealing classified information."