Verizon in January filed a legal challenge to the constitutionality of the National Security Agency’s program that collects billions of Americans’ call-detail records, but a surveillance court rejected it, according to newly declassified documents and individuals with knowledge of the matter.

In denying the phone company’s petition in March, Foreign Intelligence Surveillance Court Judge Rosemary M. Collyer embraced the arguments put forth by the government that the program is constitutional in light of a Supreme Court decision in 1979 that Americans have no expectation of privacy in dialing phone numbers.

A Verizon spokesman declined to confirm or deny that it was the company that filed the challenge. The petitioner’s name is redacted in documents released Friday, but the individuals confirmed it was Verizon, the second largest land-line company in the country.

Until January, no company had filed a legal challenge to the program, the judge said. But the documents make clear the filing came as a result of a December ruling by U.S. District Judge Richard J. Leon in Washington that the NSA program likely was unconstitutional.

The government seeks orders from the court every 90 days to serve on several phone companies, directing them to turn over to the agency on a daily basis all call-detail records. The records include numbers dialed and call times and durations, but not their content.

In January, Verizon received an order and the company filed its challenge, arguing that it could not be sure that the court had considered Leon’s opinion that the program likely violated Americans’ privacy rights, according to documents released by the Office of the Director of National Intelligence.

In February, the Justice Department responded that the court had reviewed not only Leon’s decision, but also the rulings of another federal judge and two other surveillance court judges who upheld the program as constitutional.

In March, Collyer denied Verizon’s challenge and ordered the company to continue to furnish the records. In her ruling, she rejected the reasoning of Leon, who had described the collection effort as “almost-Orwellian . . . unlike anything that could have been conceived in 1979.”

She said Leon erred by focusing on how the NSA deals with the data after it has acquired it: retaining it for five years and analyzing some of it for clues to terrorist plots. Rather, she stressed a principle upheld by the Supreme Court that a person has no privacy expectation in data voluntarily turned over to third parties, such as phone companies.

Patrick C. Toomey, an American Civil Liberties Union staff attorney, said that the 1979 case, Smith v. Maryland, involved the records of single criminal suspect collected over several days. “That case looked nothing like the NSA’s phone-records program, in which the government collects hundreds of millions of Americans’ phone records in bulk, indefinitely,” he said.