Two California divers had the surprise of their lives, when they were almost gulped down by humpback whales.

The divers noticed the whales about a quarter of a mile away when they got into the water, but thought they were at a safe distance, Pete Thomas Outdoors reported.

"We were just floating around in the water, hoping to get some shots of the whales in the distance, when all of a sudden the sardines started going crazy," Shawn Stamback, one of the divers in the video, said.

Two other divers were filming from the boat when the whales jumped out of the water, with their mouths wide open.

It is against marine laws to interfere with whale behavior, and boats are required to stay 100 feet away.

Monica DeAngelis, a mammal expert with the National Marine Fisheries Service, said she wasn't sure if any laws were violated in this particular instance.

"They certainly are lucky no one got hurt," she said. "In addition, they were clearly closer than the [100-foot] recommended guidelines."

Stamback believes the whales knew him and his diving buddy Francis Antigua were in the water and purposely avoided them because the majority of the fish were clustered beneath the pair.

"I was right in the middle of the meatball," Stamback said.

In 2011 a woman surfing near Santa Cruz, California had a similar experience, according to a youtube video.

A woman found herself caught in the middle of a "feeding frenzy," on a school of anchovies.

Humpback whales generally feed in the oceans of Antarctica and in the southern ocean during the summer months, and migrate north during the winter, according to the Wild Conservation Society.

The whales exist mostly in the southern hemisphere, but their populations used to expand through a much larger area of the world's oceans. Researchers estimate commercial whaling reduced the humpback's population to just two percent of what it once was.

WATCH:

WATCH: