Seven whales were successfully herded back to sea after they survived a mass stranding at a New Zealand beach on Saturday, conservation officials said.

About 1,000 locals and vacationers had spent several hours comforting the beached whales on the Coromandel Peninsula in the North Island.

They were refloated during the afternoon high tide and shepherded to deeper waters by several boats.

“Seven surviving (short-finned) pilot whales have been shepherded out of Matarangi Harbour. Our staff are burying four dead whales,” the department of conservation tweeted.

The marine conservation group Project Jonah had earlier appealed for trained medics to go to Mararangi to assist with the rescue.

“While the locals are doing a great job, if you are a trained medic on holiday in the region, your help would be greatly appreciated,” Project Jonah said on its Facebook page.

Short-finned pilot whales are closely related to the long-finned pilot whales that are regularly involved in mass strandings in New Zealand waters.

Two years ago, more than 330 pilot whales died in two strandings at Farewell Spit at the top of New Zealand’s South Island.