A laptop displays a message after being infected by ransomware as part of a worldwide cyberattack on June 27, 2017.

Germany is a big target of spying and cyber attacks by foreign governments such as Turkey, Russia and China, a government report said on Tuesday, warning of "ticking time bombs" that could sabotage critical infrastructure.

Industrial espionage costs German industry billions of euros each year, with small- and medium-sized businesses often the biggest losers, the BfV domestic intelligence agency said in its 339-page annual report.

The report mapped out a range of security threats, including Islamist militancy and increased far-right violence, but highlighted the growing incidence of cyber espionage.

It cited a "noticeable increase" in spying by Turkey's MIT foreign intelligence agency in Germany in 2016, following the failed July 15 coup in Turkey, and said Russia was seeking to influence a parliamentary election on Sept. 24.

"The consequences for our country range from weakened negotiating positions to high material costs and economic damage all the way to impairment of national sovereignty," it said.

Key targets were the Foreign Ministry and its overseas offices, the Finance and Economics ministries, the Chancellery and the German military.

Interior Minister Thomas de Maiziere said the government was working closely with industry to better protect German firms, with the most affected sectors being the weapons, space and aerospace and car industries, as well as research institutes.