Germany’s highest court on Wednesday struck down key planks of an anti-terror law, saying they violated privacy protections enshrined in the constitution.

The legislation passed in 2008 which covers surveillance of terror suspects by the federal police must be reworked by June 2018, the Federal Constitutional Court in the southwestern city of Karlsruhe ruled.

The law gave investigators sweeping powers to use secret cameras and bugging devices in private homes and to install government-developed surveillance software on personal computers in a bid to prevent attacks.