A 63-year-old marine biologist living on the Cook Islands got the thrill of a lifetime when a 20-odd-tonne humpback whale crowded into her personal space on a recent diving trip.

It might not have been all fun and games; with a tiger shark lurking nearby, the biologist suspects the giant mammal may have been protecting her from becoming a predator's lunch.

Nan Hauser captured her once-in-a-lifetime meeting on film while diving off Muri Beach in the Cook Islands last October.

It's thrilling to see the whale gently circle and nudge the diver, but both Hauser and her dive crew claim a far more threatening presence was nearby the whole time.

Partway through the event, the team noticed a tiger shark swimming by. And not exactly a tiny one at that.

"Other fishermen and divers have seen this same shark nearby the reef and say that it is as big as a pickup truck," Hauser told Jack Williams at the Daily Mirror.

"Some say that it is 20 feet (6 metres) long."

Hauser claimed in all of her years diving as a marine biologist for the Cook Island-based Centre for Cetacean Research and Conservation, she had never experienced anything like it.

"I've spent 28 years underwater with whales, and have never had a whale so tactile and so insistent on putting me on his head, or belly, or back, or, most of all, trying to tuck me under his huge pectoral fin," she said.

Laws in many parts of the world – including those protecting the waters of Pacific Islands – tend to restrict boats, aircraft, and people from getting too close to whales.

But when a whale decides it wants to approach you, sometimes all you can do is calmly sit and try not to get it upset.

"I tried to get away from him for fear that if he rammed me too hard, or hit me with his flippers or tail, that would break my bones and rupture my organs. If he held me under his pectoral fin, I would have drowned," says Hauser.

Hauser lived to tell the tale, suffering little more than a few scrapes and bruises. But as a biologist she was left mystified by the odd behaviour.

It's not unknown for whales to swim up to or even breach the surface near humans, either to gulp down food or simply to get a closer look.

Repeat passes and caresses are far less common, leaving Hauser to hypothesise the whale's behaviour was intentional.

"There is a published scientific paper about humpbacks protecting other species of animals, by Robert Pitman," says Hauser.

"For instance, they hide seals under their pectoral fins to protect them from killer whales."

Intelligent marine mammals shielding humans from ocean predators seems to be a tale as old as time. The ancient Greeks, for example, depicted dolphins as sacred protectors and allies in a number of their stories and works of art.

But many experts still aren't sold on the stories living up to the hype, blaming our tendency to anthropomorphise the rare situations where we do come across potentially dangerous sharks and benevolent (or at least non-aggressive) cetaceans.

Rob Harcourt, professor of marine ecology at Macquarie University in Australia, has his doubts, saying it may just have been a young, curious whale.

"I am sure the whale knew the shark was there, but as the shark is no threat to the whale, why would it think it was a threat to the human?" Harcourt told ScienceAlert.

He also offers a clear warning to potential whale watchers who might think whales are always this friendly.

"Whales do and have killed people inadvertently," says Harcourt. "A very good friend of mine was knocked unconscious by a young whale from his surfboard when the whale was behaving exactly the same as the one in the video, and only lived as he was rescued by others."

That's not to rule out altruism in this case. It's just that such encounters are too rare to study, are hard to explain, and the whales aren't talking. 

Whatever the humpback whale was thinking in this particular case, Hauser is incredibly lucky to have had such an amazing experience.