U.S. Defense Secretary Leon Panetta warned Thursday that the nation was faced with a dire cyber threat from foreign actors targeting computer control systems that operate chemical, electricity and water plants and those that guide transportation.

Addressing a gathering of business leaders in New York, Panetta said the U.S. military could act preemptively if threats are detected which U.S. officials identified as originating from China, Russia, Iran and militant groups.

“An aggressor nation or extremist group could use these kinds of cyber tools to gain control of critical switches,” Panetta was quoted by the New York Times. “They could derail passenger trains, or even more dangerous, derail passenger trains loaded with lethal chemicals. They could contaminate the water supply in major cities, or shut down the power grid across large parts of the country.”

“We know of specific instances where intruders have successfully gained access to these control systems. We also know that they are seeking to create advanced tools to attack these systems and cause panic, and destruction, and even the loss of life," Panetta said.

He lamented under-investment by the U.S. private sector and political deadlock that stymied cyber security legislation, adding that a presidential executive order was being considered “while we wait for Congress to act,” Reuters reported.

Panetta said the "Shamoon" virus that attacked Saudi Arabia's state oil company ARAMCO in August was probably the most destructive attack the business sector has seen to date, adding that the sophisticated virus replaced crucial system files with an image of a burning U.S. flag.

"More than 30,000 computers that it infected (at ARAMCO) were rendered useless and had to be replaced," he said.

He said the virus included a routine called a "wiper," coded to self-execute, which overwrote all the real data on the machine with garbage data.

"Imagine the impact an attack like this would have on your company," Panetta said, calling for steps to bolster the nation's cyber defenses.

Six major U.S. banks came under a wave of cyber attacks in late September, by a group claiming Middle Eastern ties, causing blackouts and delays in Internet banking.

Customers of Bank of America, JPMorgan Chase, Citigroup, U.S. Bank, Wells Fargo and PNC could not access their accounts or pay bills online, after the banks suffered denial of service attacks, in which hackers bombard a website with hits until its server goes offline due to overload.

A hacker group called Izz ad-Din al-Qassam Cyber Fighters took credit for the attacks in online posts saying the attacks were in retaliation for an anti-Islamic video produced in the U.S which had resulted in protests among Muslims across the world.

According to a Politico report Oct. 1, White House Press Secretary Jay Carney downplayed a report that Chinese hackers had infiltrated a secure national security network used to control nuclear codes, saying the perpetrators breached an "unclassified" system.

There is "no indication whatsoever that exfiltration of data" occurred, he was quoted saying by Politico. Such attacks, he added, "are not infrequent."

Panetta said “potential aggressors should be aware that the U.S. has the capacity to locate them and to hold them accountable for actions that may try to harm America," adding the Pentagon was finalizing the most comprehensive change to the rules of engagement in cyberspace in seven years.

According to a Reuters report, an unnamed U.S. official said Washington knew who carried out the attacks cited in Panetta's speech, but declined to disclose that information.