Germany's highest court has restricted the right of the security services to spy on the computers of suspected criminals and terrorists.
Germany says cyber spying is a vital tool against terrorism
Under the technique, software sent in an email enables the authorities to spy on a suspect's computer hard drive.
The Federal Constitutional Court in Karlsruhe said cyber spying violated individuals' right to privacy and could be used only in exceptional cases.
Civil liberties activists have warned of an unacceptable invasion of privacy.
The case - which began last year - was brought after the western state of North Rhine-Westphalia allowed officials to begin using the technique.
Court President Hans-Juergen Papier said that using such software contravened rights enshrined in Germany's constitution, adding that the decision would serve as a precedent across the country.
The ruling emphasised that cyber spying by the authorities would have to receive the permission of a judge.
The German government has described cyber spying as a vital tool in fighting terrorism.
Interior Minister Wolfgang Schauble welcomed the possibility of using the strategy and said it would be considered as part of plans to change the law.
"The court's decision must be carefully analysed and will be accounted for as the legislation is modified," he said.
Judicial approval is already required in Germany for a suspect's telephone to be tapped, and the interior ministry had been expecting the court to make a similar requirement for spying on computers.
During the case, Germany's independent privacy commissioner Peter Schaar argued that the measure would be a "further alarming step towards ever more sweeping surveillance".
Germany has uncovered a number of alleged terrorist plots in recent years.
In September 2007, the authorities arrested three men whom they claimed were planning bomb attacks around the country and belonged to militant Islamist group al-Qaeda.