Sonar approved for use by the US Navy broke marine laws, a US appeals court has ruled.
The low-frequency active sonar, approved in 2012, is used to detect enemy submarines.
But it can also harm whales, dolphins and walruses that rely on underwater sound for navigating, catching prey and communicating, according to environmental groups.
The case will now be sent back to a lower court for further consideration.
In 2012, the National Marine Fisheries Service permitted navy sonar use but required it to shut down or delay use when a marine mammal was detected near the ships. Loud sonar pulses were also banned near coastlines and in certain protected waters.
Environmental groups, led by the Natural Resources Defense Council, filed a lawsuit in response, claiming the approval violated the Marine Mammal Protection Act.
The San Francisco federal appeals court ruled that the approval rules granted to the US Navy failed to meet a section of the protection act that required the programme to have “the least practicable adverse impact on marine mammals”.
While it said it believed the navy had attempted to follow guidelines, it concluded that the fisheries service “did not give adequate protection to areas of the world’s oceans flagged by its own experts as biologically important”.
According to experts, the sonar systems used by the navy generate sound waves that can reach 235 decibels – a loud rock band reaches around 130.
These sound waves can travel for hundreds of miles under water and can retain an intensity of 140 decibels as far as 300 miles from their source.
Although direct correlations are hard to find, some scientists believe that the use of sonar has changed the behaviour of whales which have been observed swimming away, sometimes hundreds of miles, rapidly changing their depth and beaching themselves.