Germany's Bundestag has voted for a new version of the data retention law that caused so much controversy in the past, with the new regulations approved by 404 to 148 votes, with seven abstentions.

The new law will force telcos to store call and email records for 10 weeks, as well as metadata including information about who called or emailed whom and when, and call duration. IP addresses will also be logged.

In an effort to appease privacy advocates and the opposition parties, mobile phone location data will only be stored for four weeks.

The data is only to be used in the investigation of terrorism and other serious crimes and plods must get a judge's consent before rifling through personal metadata, and the individual in question must be notified.

Justice Minister Heiko Maas defended the new law, saying that it was proportionate as – in contrast to earlier legislation – less data would be stored and retained for a shorter time.

“Thus, we will fully comply with the Supreme Court’s ruling,” said Maas, referring to the 2010 decision of the German Federal Constitutional Court to declare an earlier version of the data retention law unconstitutional.

As a former staunch opponent of data retention, opposition MPs accused Maas of being spineless and caving in to pressure from party leader Sigmar Gabriel.

Privacy activists and opposition politicians have said they plan to make a legal appeal against the new law.

Germany, along with Sweden, was one of the few EU countries to challenge the Europe-wide 2006 Data Retention Directive. Last year the European Court of Justice followed the German court’s decision and demolished the directive altogether. ®