Media playback is unsupported on your device Media caption President Obama; ''We will not monitor the communications of... our close friends and allies''

President Barack Obama has ordered curbs on the use of bulk data collected by US intelligence agencies, saying civil liberties must be respected.

Mr Obama said such data had prevented terror attacks at home and abroad, but that in tackling threats the government risked over-reaching itself.

However civil liberties groups have said the changes do not go far enough.

The announcement follows widespread anger after leaks revealed the full extent of US surveillance operations.

The president has not put a lid on this debate - indeed he rather has given the pot a vigorous stir

The leaked documents revealed that the US collects massive amounts of electronic data from communications of private individuals around the world, and has spied on foreign leaders.

The latest revelations claim that US agencies have collected and stored almost 200 million text messages every day across the globe, according to the Guardian newspaper and Channel 4 News.

'Rights are protected'

In his much-anticipated speech at the Department of Justice, Mr Obama said he would not apologise for the effectiveness of US intelligence operations, and insisted nothing he had seen indicated they had sought to break the law.

It was necessary for the US to continue collecting large amounts of data, he said, but acknowledged "the potential of abuse".

"The reforms I'm proposing today should give the American people greater confidence that their rights are being protected, even as our intelligence and law enforcement agencies maintain the tools they need to keep us safe," he said.

Image copyright Reuters Image caption The US was embarrassed by the reports it had spied on German Chancellor Angela Merkel

Details of the times, numbers and durations of phone calls - known as metadata - are currently collected and held by the National Security Agency (NSA). But Mr Obama said he was ending that system "as it currently exists".

He has asked the attorney general and the intelligence community to draw up plans for metadata to be held by a third party, with the NSA requiring legal permission to access them.

A panel of independent privacy advocates would also sit on the secret Foreign Intelligence Surveillance Court (FISC) which has responsibility for giving permission for mass surveillance programmes.

Mr Obama offered assurances to non-Americans, saying people around the world "should know that the United States is not spying on ordinary people who don't threaten our national security".

"This applies to foreign leaders as well," he said, promising that from now on the US "will not monitor the communications of heads of state and government of our close friends and allies".

It was revealed last year that the US had spied on friendly foreign leaders, including on the personal mobile of German Chancellor Angela Merkel.

A spokesman for Mrs Merkel said on Friday many Germans were "rightfully concerned" by spying reports and that the rights of foreign citizens must be respected.

He said Berlin would continue to hold confidential talks with the US on "a new clear basis for co-operation amongst intelligence agencies".

Mr Obama was also critical of nations he said "feign surprise" over US snooping but "privately acknowledge that America has special responsibilities as the world's only superpower" and have used the information gathered for their own purposes.

'Music on Titanic'

Edward Snowden, the former NSA contractor at the who leaked the information, is wanted in the US for espionage and is now living in exile in Russia.

Civil liberties groups see him as a hero for exposing what they see as official intrusions into private lives, but many Americans believe he has endangered American lives.

The president said he would not "dwell on Mr Snowden's actions or his motivations", but warned that the "sensational way" the NSA details had come to light had potentially jeopardised US operations "for years to come".

Image copyright Reuters Image caption Edward Snowden has become a hero of the campaign for civil liberties

Mr Obama's reforms were welcomed as progress in some quarters, but others argued they did not go far enough in protecting individuals.

"President Obama's surveillance adjustments will be remembered as music on the Titanic unless his administration adopts deeper reforms," said Steven W. Hawkins, executive director of Amnesty International USA.

"Shifting the storage of information does not address the fundamental problem: the collection of mass personal data in the first place," he said in a statement.