Thursday’s ruling was a setback for the Bush administration, which has defended the programme as an essential tool in its “war on terrorism”.
Judge Anna Diggs Taylor said the controversial practice of warrantless phone tapping, known as the Terrorist Surveillance Programme, violated free speech rights, protections against unreasonable searches and the constitutional check on the power of the presidency.
The programme has been widely criticised by civil rights activists and raised concern among politicians, including some in George Bush’s own Republican party, who say the president may have overstepped his powers by authorising it.
“Plaintiffs have prevailed, and the public interest is clear, in this matter. It is the upholding of our constitution,” Taylor wrote in her 43-page opinion.
The American Civil Liberties Union filed the lawsuit on behalf of journalists, scholars and lawyers who say the programme has made it difficult for them to do their jobs.
They believe many of their overseas contacts are likely targets of the programme, which involves secretly listening to conversations between people in the US and people in other countries.
The US government had asked for the lawsuit to be thrown out, arguing that any court action on the case would jeopardise secrets in the war on terrorism.
Bush authorised the NSA programme after the September 11, 2001, attacks on the US, and it became public last year.
The programme allows the government to eavesdrop on the international phone calls and emails of US citizens without obtaining a warrant, if in pursuit of al-Qaeda.
Democrats and some Republicans say the programme could overstep Bush’s authority as commander in chief and appears to violate the 1978 Foreign Intelligence Surveillance Act, or FISA.
FISA requires warrants for individual eavesdropping on suspects inside the US.