WASHINGTON (CNN) -- The Supreme Court on Wednesday lifted sanctions placed on the Navy over its underwater sonar testing, a setback for environmental groups that claimed the warfare technology was harming whales and other marine mammals.
An endangered blue whale surfaces off the coast of Southern California in July.
At issue in the 5-4 ruling was whether the Navy's need to conduct exercises to protect the country from enemy submarines outweighed concerns raised by environmental groups.
The case focused on whether the president had the power to issue executive waivers allowing such tests and whether federal judges can issue preliminary injunctions blocking them. The high court ultimately sided with claims of national security over environmental concerns.
Those environmental interests, said Chief Justice John Roberts for the majority, "are plainly outweighed by the Navy's need to conduct realistic training exercises to ensure that it is able to neutralize the threat posed by enemy submarines."
Roberts said a lower federal court "abused its discretion" by imposing a 2,200-yard perimeter for testing and ordering a shutdown of sonar use during surfacing exercises.
But in dissent, Justice Ruth Bader Ginsburg warned that the ecological damage was significant.
"This likely harm cannot be lightly dismissed," she said, "even in the face of an alleged risk to the effectiveness of the Navy's 14 training exercises."
Justices David Souter, Stephen Breyer and John Paul Stevens also questioned the Navy's arguments.
The exercises have continued while the case was under appeal.
Environmentalists had sued the Pentagon over the practice, and a federal judge ordered major changes to the Navy's annual offshore training exercises in March.
President Bush had issued an emergency waiver to allow the exercises to go on without the filing of an environmental impact study, but the lower court ruling blocked the use of sonar. That federal judge, in ruling against the government last March, said it was "constitutionally suspect" for Bush to issue the national security exemption to allow skipping the impact study.
Military officials argued that the restrictions could hamper readiness in time of war, because new sonar technology is needed to detect increasingly sophisticated enemy submarines.
"This case was vital to our Navy and nation's security, and we are pleased with the Supreme Court's decision in this matter," Navy Secretary Donald Winter said. "We can now continue to train our sailors effectively, under realistic combat conditions."
One of the environmental organizations that sued the Defense Department told the justices that the exercises had been planned in advance and that the Navy was required under law to conduct more extensive environmental tests than it had.
The waters of southern California are home to dozens of species of whales, dolphins, seals and sea lions, nine of them federally listed as endangered or threatened. Federal courts have cited scientific studies and the Navy's own conclusions that high levels of sonar can cause hearing loss and disorientation in the animals.
In February, the U.S. Navy demonstrated for CNN its onboard procedures for turning down mid-frequency sonar when whales come within 1,000 meters and shutting it off completely when they approach 200 meters.
The sonar sounds like a "ping, ping" noise, and it can be reduced as necessary, officers said.
But environmentalists say that the sonar can hurt whales much farther than 1,000 meters away and that the noise created by the sonar "was like having a jet engine in the Supreme Court multiplied 2,000 times, compensating for water," attorney Richard Kendall told the justices.
Reacting to the ruling, Kendall said, "It is gratifying that the court did not accept the Navy's expansive claims of executive power and that two-thirds of the injunction remain in place."
In 2000, 16 whales beached themselves in the Bahamas, and the Navy concluded that too many sonar ships had been operating in a narrow underwater channel.
The service says it is funding $16 million in independent research to minimize sonar's effect on marine mammals.