Image caption The court order was described by one civil rights group as "beyond Orwellian"

The US National Security Agency (NSA) is collecting the telephone records of tens of millions of Americans, US officials have confirmed.

The practice, first reported by the Guardian newspaper, has been used to stop a "significant" terrorist attack on the US, a senior congressman said.

On Wednesday, the newspaper published the secret order directing the Verizon company to hand over telephone data.

Civil liberties groups said the details of the report were "stunning".

Senior US Senator Dianne Feinstein on Thursday confirmed the secret court order was a three-month renewal of an ongoing practice.

US House intelligence committee chairman Mike Rogers told reporters collecting Americans' phone records was legal, authorised by Congress and had not been abused by the Obama administration.

He said it had prevented a "significant" attack on the US "within the past few years" but declined to offer more information.

Later, White House spokesman Josh Earnest described the practice as a "critical tool" enabling US authorities to monitor suspected terrorists.

'Indefensible'

Analysis After years of allegations, lawsuits and sporadic, vaguely-worded warnings from members of Congress, finally there is a piece of hard evidence, a window into the reality of post-9/11 intelligence surveillance. The breadth of this dragnet is breathtaking. The thought that the phone records of millions, this reporter included, have been collected on an order of the secretive Foreign Intelligence Surveillance Court is a little creepy, to say the least. Should we demand action to stop it? Some civil rights activists say absolutely. Such behaviour, they argue, simply runs counter to the letter of the Fourth Amendment to the US Constitution, which says there has to be "probable cause, supported by Oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized", before any of this can happen. The reality is that since 9/11, the national security establishment and telecommunications firms, with the aid of Congress, have constructed a new surveillance environment. We just haven't been told about it.

The security agencies and Verizon have not commented.

The document published by the Guardian was signed by Judge Roger Vinson of the secret Foreign Intelligence Surveillance Court on 25 April and lasts until 19 July.

It falls under a section of the Bush-era Patriot Act, which allows access to business records for "foreign intelligence and international terrorism investigations".

The order requires Verizon - one of the largest phone companies in the US - to disclose to the NSA the metadata of all calls it processes, both domestic and international, in which at least one party is in the US.

Such metadata includes telephone numbers, calling card numbers, the serial numbers of phones used and the time and duration of calls. It does not include the content of a call or the callers' addresses or financial information.

The White House has emphasised the court order did not authorise US government agents to listen in on Americans' telephone conversations.

But the government could request a wiretap of specific suspicious numbers from the court, which would allow the government to monitor the calls in real time, record and store them.

The measure also contains a gagging order, requiring that "no person shall disclose to any other person that the FBI or NSA has sought or obtained tangible things under this Order".

Reaction for and against the practice has cut across party lines.

"To simply say in a blanket way that millions and millions of Americans are going to have their phone records checked by the US government is to my mind indefensible and unacceptable," Senator Bernie Sanders, a liberal independent, said.

Republican Senator Rand Paul said in a statement he would introduce a bill to prevent security agencies from searching phone records without probable cause on Friday.

But Republican Senator Lindsey Graham said he had no problem with the practice.

"If we don't do it, we're crazy," he said. "If you're not getting a call from a terrorist organisation, you've got nothing to worry about."

'Millions of people'

The court order Verizon is required to hand over data "on an ongoing, daily basis" until 19 July

Covers all local and domestic US phone calls, and calls from the US abroad, but not calls made wholly in foreign countries

Metadata to be provided includes telephone numbers, handset identifying numbers, calling cards used and the time and duration of calls

Prohibits disclosure of the order's existence

Mark Rumold, a staff attorney at the Electronic Frontier Foundation, told the BBC the court order covered the telephone calls of "millions and millions of people".

He said the law provided for narrower ways for US officials to gain access to the calls of persons of interest and those who contact them.

"This isn't that," Mr Rumold said.

"I believe the NSA has a running map of domestic communications" enabling officials to track the phone calls of foreign targets to US numbers and then any subsequent calls placed from those numbers.

The EFF has suspected authorities had been conducting such surveillance for years. A report appeared in the USA Today newspaper in 2006.

Mr Rumold believes the firms do not challenge these orders.

The US government has previously said obtaining metadata does not require a warrant because it does not constitute personal information.

But rights groups have fiercely criticised the order, with the American Civil Liberties Union (ACLU) describing it as "beyond Orwellian".

"It provides further evidence of the extent to which basic democratic rights are being surrendered in secret to the demands of unaccountable intelligence agencies," said Jameel Jaffer, ACLU's deputy legal director.

'Stunned'

Two Democratic senators have been pressing the Obama administration to clarify the scope of its public surveillance.

Last year, Mark Udall and Ron Wyden wrote to US Attorney General Eric Holder saying they believed "most Americans would be stunned" by the government's "secret legal interpretations" of the Patriot Act.

The White House came under heavy criticism last month after papers were leaked showing it had gathered the phone records of journalists at the Associated Press.

The story prompted questions from both Republicans and Democrats in Washington about how the White House was balancing the need for national security with privacy rights.

The Obama administration has aggressively investigated disclosures of classified information to the media, bringing more cases against people suspected of leaking such material than any previous administration, correspondents say.