The ruling, late on Wednesday in San Francisco, may chip away at restrictions on the export of encryption technologies, which are officially classified as "military weaponry".
Academics hailed the ruling by the US District Judge Marilyn Hall Patel as a victory for free speech, while computer industry executives called it a milestone for American software producers.
Daniel Bernstein, assistant professor at the University of Illinois-Chicago, and the man at the centre of the case, said: "It's really such a shock to switch from fear of this law to suddenly maybe I can do something. As far as I can tell, I'm free."
The judge's decision stopped short of forbidding all restrictions on the export of encryption, codes that allow computer messages to be scrambled so they are virtually unbreakable by any but the intended receiver.
But Judge Patel said the present rules, which treat such computer programs as if they were military weapons, were "an unconstitutional prior restraint [of speech] in violation of the First Amendment". The First Amendment guarantees freedom of speech and of the press.
Lawyers said the ruling willallow anyone in the US to post source code, or instructions for how to encrypt messages, on the Internet. However, new federal rules that take effect from 1 January mean the judge's decision may not have the results the industry hoped for, said the Electronic Frontier Foundation, an online civil rights group. It is not clear if the ruling covers only theoretical mathematical explanations of how such programs work or if actual software, which could be run and sold, can also be freely distributed around the world, the group said.
The White House declined to comment on the judgment, although the State Department is expected to appeal. Last year a Justice Department lawyer argued in court that a code whose sole function was to create secrecy should not be considered a protected form of speech. A message scrambled by the code, he said, "could be a love letter, or it could be a communication from [the Iraqi President] Saddam to bomb Kuwait."
Professor Bernstein's victory marks a triumph for the US Constitution over its government. Restrictions on the export of encryption techniques were introduced in the Cold War.
More recently, the US and other Western governments, have argued that the restrictions are needed to keep tabs on terrorist organisations. This allows the export only of "weak" encryption programs, which while in effect impossible for individuals to crack, are probably not safe from a government-owned supercomputer.
Allowing more powerful encryption programs to spread unchecked would make it impossible to track conspiracies and criminals, they have argued.
US software companies and citizens have complained that the restrictions handicap them, and that online shopping, international banking and corporate negotiations would benefit from having high-level encryption, which could be used and sold around the world.
Last month, President Bill Clinton signed an order liberalising US export policy, to allow companies to sell slightly more powerful encryption programs abroad, but only if the companies make assurances that US law enforcement could intercept the communications.
Professor Bernstein came to the State Department's notice when he wrote an encryption program called Snuffle. This allows users to scramble messages that move across computer networks. The messages can then be read only by using his decryption program, Unsnuffle. The State Department decided in 1993 that the programs required licenses to communicate them on the Internet, prompting the lawsuit.
Judge Patel noted the office that makes the licensing decisions has no standards for denying a license. The president and chief executive of RSA Data Security, the world's largest producer of encryption technology, praised the ruling. "We invented this technology but we can't pursue it because of US export controls," said Jim Bizdos.Reuse content