President Barack Obama has staunchly defended the sweeping US government surveillance of Americans' phone and internet activity.

Mr Obama called it a modest encroachment on privacy that was necessary to defend the United States from attack.

The president said the programs were "trade-offs" designed to strike a balance between privacy concerns and keeping Americans safe from terrorist attacks.

He said they were supervised by federal judges and congress, and that politicians had been briefed.

"Nobody is listening to your telephone calls. That's not what this programme is about," Mr Obama told reporters during a visit to California's Silicon Valley.

"In the abstract you can complain about Big Brother and how this is a potential programme run amok, but when you actually look at the details, I think we've struck the right balance," he said.

"There are trade-offs involved", the president added.

The Washington Post reported that federal authorities have been tapping into the central servers of companies including Google, Apple and Facebook to gain access to emails, photos and other files allowing analysts to track a person's movements and contacts.

That added to privacy concerns sparked by a report in the Guardian newspaper that the National Security Agency had been mining phone records from millions of customers of a subsidiary of Verizon Communications.

President Obama, who pledged to run the most transparent administration in US history, said that he came into office with a "healthy scepticism" about the surveillance programs but had come to believe "modest encroachments on privacy" were worth it.

PRISM Surveillance Program

The Washington Post said the surveillance program involving firms including Microsoft, Skype and YouTube, code-named PRISM and established under Republican President George W Bush in 2007, had seen "exponential growth" under the Democratic Obama administration.

It said the NSA increasingly relies on PRISM as a source of raw material for its intelligence reports.

James Clapper, the director of national intelligence, said the report contained "numerous inaccuracies," and some of the companies identified by the Washington Post denied that the NSA and Federal Bureau of Investigations had "direct access" to their central servers.

Microsoft said it does not voluntarily participate in government data collection and only complies "with orders for requests about specific accounts or identifiers."