
Three judges at a Cincinnati court reached a majority decision that the programme was within the limits of the constitution, and that inspecting people's email and phone conversations is allowable.
The US government had argued that it needed the powers to monitor terrorist suspects.
"We are deeply disappointed by today's decision that insulates the Bush Administration's warrantless surveillance activities from judicial review and deprives Americans of any ability to challenge the illegal surveillance of their telephone calls and emails," said the American Civil Liberties Union (ACLU).
"It is important to emphasise that the court today did not uphold the legality of the government's warrantless surveillance activity.
"Indeed, the only judge to discuss the merits clearly and unequivocally declared that the warrantless surveillance was unlawful. We are currently reviewing all our legal options, including taking this challenge to the US Supreme Court."
ACLU and others brought the case, arguing that spying on citizens had been banned in 1978.
The dissenting judge argued that this case was in breach of that ruling but the majority ruled that, as the plaintiffs had not personally been affected, the case must fail.
The Senate Judiciary Committee is currently investigating the programme and has subpoenaed records from the White House relating to the case.