There was a lot that was ordinary about the hearing in Courtroom 20B of the Manhattan federal courthouse on Friday morning: a team of lawyers at the plaintiff’s table, spectators in the gallery. What was extraordinary was the defendant, the United States government, and the lawsuit it is facing over the National Security Agency’s seven-year-old, once top-secret phone-surveillance program, which until this week it never had to defend in open court.

Until Edward Snowden, a disaffected N.S.A. contractor, came along and documented the stunning scope of the phone program — which vacuums up information about every call made in the United States every day for the purpose of identifying possible terror suspects — intelligence and law-enforcement officials were accustomed to operating in the friendlier confines of the Foreign Intelligence Surveillance Court.

That is not a court by any standard definition. A rotating slate of federal judges considers secret warrant applications from the government and issues secret opinions, without hearing any opposing argument. In 2012, the court approved 1,855 of 1,856 requests that came before it.

The environment on Friday was very different, as lawyers for the A.C.L.U. vigorously contested the legality of the phone-data sweep, and Federal District Judge William Pauley III expressed a proper skepticism of the government’s claim that the program raised no constitutional concerns. When a government lawyer argued that Congress twice reauthorized the Patriot Act section under which the phone program has been approved, Judge Pauley reminded him that several members of Congress have said publicly they were not made aware of what was in the program. Others have said they believe it is being abused.