Sixteen pilot whales, including four calves, have died in a mass stranding on the coast of Fife in Scotland as rescuers fought a desperate battle to save others.

The pod of 26 was discovered in a cove at the base of steep cliffs in Pittenweem, near St Andrews, shortly after 7am on Sunday.

Vets from the British Divers and Marine Life Rescue (BDMLR), with help from the emergency services, managed to refloat 10 whales at high tide at 4.30pm. Two subsequently re-stranded but were refloated by volunteers.

The BDMLR said they were "hopeful" for those whales still in the water and would be monitoring them for the next 24 hours.

A further 24 pilot whales from the same pod have been seen in the shallows three miles along the coast at Cellardyke. They were being closely observed amid fears they might also beach.

Ali Jack, Scottish co-ordinator of the BDMLR, said: "It's been a fantastic effort by what seems hundreds of people. We managed to herd the pilot whales back out to sea using our pontoon. Two came back but we have got them out again.

"We are hopeful all the 10 will survive, but I would say the chances are 50-50. It's up to the animals now. People here certainly couldn't have done more – they were magnificent."

Gareth Norman, area co-ordinator for the BDMLR, said the scene was "like an aircraft crash".

Forth coastguard was initially alerted to a reported mass stranding of dolphins. By the time a rescue operation could be launched, 13 of the whales, which can measure up to six metres (20ft), had already died.

Teams of volunteer medics from BDMLR were sent to the area, with specialist rescue pontoons from across Scotland, Newcastle and Cumbria.

More than 30 medics were on the scene and were being assisted by an additional 25 from the emergency service organisations including the coastguard, Fife fire service, Fife police and the SSPCA charity.

A spokesman for Fife coastguard said: "It is a very rare occurrence in Scotland and very sad. The usual scenario would be that the whale that is leading the group has become ill, or has lost its way, and gets beached and the rest will follow on, although we do not know for sure if that is what happened."

The public was urged to stay away from the scene as rescuers tended to those stranded, trying to keep their blow holes upright and keeping them moist, until they could be refloated on the high tide on Sunday afternoon.

In July last year some 25 out of 70 pilot whales that stranded in the Kyle of Durness in Sutherland died in what is believed to be Scotland's largest ever beaching of pilot whales. In November 2010, 35 whales were found dead on a beach in County Donegal in Ireland.