Under the shadow of two lighthouses, sheep graze along the sea-swept coastline of North Ronaldsay. But these are no ordinary sheep, and newcomers to the island may be surprised. Instead of munching grass, these sheep eat seaweed.

North Ronaldsay is the most remote of the 70 islands of Orkney, which lie north of the Scottish mainland, and the sheep outnumber the people. From the moment the tide begins to go out, dozens of sheep move nimbly among the treacherous, wet rocks, delicately foraging.

Their appetite for algae is not just a quirky behaviour. It has reshaped their bodies and their lifestyles. In fact the sheep are almost unique: aside from a single kind of lizard from the Galápagos Islands, they may be the only animals in the world that can survive entirely on seaweed.

North Ronaldsay sheep are smaller than other breeds: they measure about 18 inches (45cm) to their shoulder and rarely weigh more than 42lb (19kg). As sure-footed as goats, they are well-suited to the island's rocky coastline.

They are also rare. With only about 3,000 members on North Ronaldsay itself, and just 550 breeding females on the mainland, the breed is listed as vulnerable on the watchlist of the Rare Breeds Survival Trust in Kenilworth, UK.

They like grass as well. But they want the seaweed

And, like other primitive breeds, the North Ronaldsay sheep are hardy animals.

"They're very self-sufficient. They don't generally need human intervention in terms of lambing, or having problems with their feet, or anything like that," says Ruth Dalton of the Rare Breeds Survival Trust. "They're quite close to how sheep were in the wild, compared to what humans have done to them to put meat on in the right place and to have more wool and the rest of it."

They act it, too: they are relatively unused to seeing humans. Approach them slowly, and they will stop and stare. Take another step and they streak off across the rocks, fast as lightning. Their more domesticated brethren on the mainland are far more used to humans.

However, none of that is as unusual as their penchant for eating algae.

"They like grass as well. But they want the seaweed," says Billy Muir, one of their owners. His sheep graze beneath the same lighthouse that he has served as a keeper of since 1969.

A 2006 study found that some North Ronaldsay sheep eat nothing but seaweed all year round

For most of each year, for the past 183 years, the sheep have been kept to the sea-facing side of a 6ft (1.8m) tall stone dyke that runs for 13 miles (21km). The dyke was constructed in 1831 to preserve the pastures inland for other domestic animals.

The dyke means they are on a strict seaweed-only diet. The supply is abundant, thanks to powerful winter storms that pile an all-you-can-eat buffet up onto the coastline.

The lambing season, in summer from May to August, is the only time that the sheep are allowed onto pasture. At this time, patches of green also grow on the coastal side of the dyke. But even then, not all of them go for the grass. A 2006 study found that some North Ronaldsay sheep eat nothing but seaweed all year round.

Farmers may have used algae to feed domestic animals as early as the 5th millennium BC. Orkney's difficult winters and isolated location mean that its sheep may have had to survive without grass for months on end.

Being plonked onto a different diet can make them prone to copper toxicity and even kill them

In 2006, a carbon-13 analysis was done on a Neolithic sheep tooth found on Papa Westray, another Orkney island. It showed that seaweed provided at least part of the sheep's diet as far back as 5,000 years ago.

The sheep's taste for cheap, plentiful seaweed might have solved problems for farmers, but it caused problems for the animals themselves. Their digestive systems have had to change to extract from the seaweeds, which contain sugars like alginic acid that differ from those in green plants.

It also means the sheep can't always be simply moved to pasture or supplementary feeds. They have adapted to absorb more of certain minerals, especially copper, from seaweed, so being plonked onto a different diet can make them prone to copper toxicity and even kill them.

They have not adapted perfectly to their unusual lifestyle. In four visits carried out by scientists from 1983 to 1985, 71 native sheep were found dead.

One of the biggest reasons was malnutrition. It's unclear whether that was because of overpopulation and competition for seaweed, or something to do with the seaweed itself.

They sleep when it's high tide and eat when it's low

"Young adult animals died largely of heavy parasite burdens combined with inadequate nutrition, while the older sheep often starved because of severe dental disease precipitated by heavy deposits of tartar on the cheek teeth – rarely seen in sheep on a more conventional diet," the scientists wrote. "The pathological findings suggest that adaptation to the peculiar environmental rigours and dietary restrictions on North Ronaldsay is less complete than has previously been assumed."

What's more, foraging for seaweed can be dangerous. As the tide goes out, the sheep follow it. Some might even swim to an outflow for more seaweed. That can end up drowning if they get the timing wrong.

The sheep are closely attuned to the tides, which dictate when they sleep. "They sleep when it's high tide and eat when it's low," chuckles Muir. "They're governed by the moon and the stars, there's no doubt about that."

But for all that we understand about their lifestyles, no one is exactly sure where the North Ronaldsay sheep came from.

One theory has it that they are the descendants of ancient sheep that lived on the hills. When the last ice age ended and the North Sea flooded the valleys, those hills became the islands of Orkney and the sheep were stranded on them.

On North Ronaldsay, the dyke prevents them from mixing

They are North Atlantic short-tailed sheep, which means they are related to other primitive breeds like the Shetland sheep. The suggestion is that each group of sheep became isolated on their own islands and went down their own paths: North Ronaldsay sheep became one breed, Shetlands another.

At one point, the North Ronaldsay sheep were spread across the islands of Orkney. On the other islands they were crossed with other breeds like Merinos, in a bid to make them grow bigger and yield more wool. But on North Ronaldsay they were kept "pure".

That decision also kept them rare.

The sheep that live on the mainland will inevitably mix with other breeds one day. But on North Ronaldsay, the dyke prevents them from mixing.

Their island home might vanish from under their feet

That may not be true forever. In the winter of 2012-13, violent storms collapsed parts of the dyke. A survey carried out in July 2015 determined that 2.9 miles (4.7km) of the dyke have to be rebuilt.

"Without the sheep dyke being able to keep them separate from other breeds of sheep on the island, the integrity of this breed could be lost," says Dalton.

In the long run, the sheep face a far greater threat than that posed by the damaged dyke. Their island home might vanish from under their feet.

The island of North Ronaldsay is small, just 3 miles (4.8km) long and 1 mile (1.6km) wide, and it's low. The highest point is only 65ft (20m) above sea level, the tiny airport sits at 40ft (12m), and the dyke is barely above the sea at all.

If temperatures warm by 4 °C by 2100, which they are currently on track to do, the seas might eventually rise 30ft (10m)

All of which makes the most recent report from the Intergovernmental Panel on Climate Change, published in 2013-14, particularly bad news for North Ronaldsay. It predicts that sea levels will rise up to 3ft (1m) over the 21st century.

Worse, they will continue rising for centuries even if we manage to stabilise the global temperature, because it takes the heat centuries to melt the world's ice sheets. If temperatures warm by 4 °C by 2100, which they are currently on track to do, the seas might eventually rise 30ft (10m).

That would swamp much of the island, and its sheep.

For now, though, if you go to North Ronaldsay you can see its seaweed-eating sheep finding their dinner among the black rocks of the Scottish coast. They remain oblivious to the idea of rolling green hills and pastures, and to the rising seas.

This story is a part of BBC Britain – a new series focused on exploring this extraordinary island, one story at a time. Readers outside of the UK can see every BBC Britain story by heading to the Britain homepage; you also can see our latest stories by following us on Facebook and Twitter.