The German government has approved a draft law aimed at lifting many of the restraints on its spy agencies imposed during the postwar period as the country reels from two attacks in a month that have exposed serious security gaps.

The controversial changes, which must still pass parliament, largely comply with a wishlist pulled together by the foreign and domestic intelligence services, which have long complained Germany lags behind its allies and enemies.

“We are turning our intelligence services into genuine secret services,” the interior minister, Alexander Dobrindt, told Bild newspaper, which called it a security “revolution” and “historic”.