The Navy's plans estimate it could inadvertently kill 155 whales and dolphins off Hawaii and Southern California, mostly from explosives. It estimated it could cause more than 11,000 serious injuries off the East Coast and 2,000 off Hawaii and Southern California.

Lt. Cmdr. Matt Knight, a U.S. Pacific Fleet spokesman, said the settlement preserves key testing and training.

"Recognizing our environmental responsibilities, the Navy has been, and will continue to be, good environmental stewards as we prepare for and conduct missions in support of our national security," Knight said.

Under the agreement, the Navy cannot use sonar in Southern California habitat for beaked whales between Santa Catalina Island and San Nicolas Island. Sonar also is not allowed in blue whale feeding areas near San Diego, according to the environmental groups.

In Hawaii, the deal prohibits sonar and explosives training on the eastern side of the Big Island and north of Molokai and Maui. The groups said that will protect Hawaiian monk seals and small populations of toothed whales, including the endangered false killer whale.

The Navy also won't be able to exceed a set number of major training exercises in the channel between Maui and the Big Island and on the western side of the Big Island.

"The goal of the settlement is to try to reduce as much as we can through an agreement with the Navy," Henkin said. "By establishing some safe havens ... the hope is to bring down those estimated numbers of injury and death."

The agreement also says that if there are injuries or deaths, there will be a swift review by the National Marine Fisheries Service, which approved the Navy's plans, Henkin said.

The settlement comes after Earthjustice and other environmental groups sued in 2013, challenging the fisheries service's decision to allow the training. Additional environmental groups later filed a similar lawsuit in San Francisco. The two cases were consolidated in Hawaii, and the deal resolves both.

U.S. District Court Judge Susan Oki Mollway ruled in March that the fisheries service violated environmental laws when it approved the Navy's plans. The military branch, she said, also failed to take a hard look at alternatives such as training in different areas or at different times to avoid potentially harming dolphins, whales and other species.

After the ruling, the Navy "faced the real possibility that the court would stop critically important training and testing," said Knight, of the U.S. Pacific Fleet.

The ruling set the stage for settlement talks, Henkin said. But it didn't stop the Navy from continuing with training allowed by the service's five-year permit approved in 2013.

The Associated Press