Image copyright Stefan Solberg Image caption The team found melanin in the animals' fossilised skin which suggests they were very dark

The colour of sea creatures that lived millions of years ago has been revealed by scientists.

Research suggests that three reptiles found in the ancient oceans were near-black.

The international team has found melanin - the light-absorbing pigment that is responsible for colour - preserved in the animals' fossilised skin.

The study is published in the journal Nature.

The lead researcher Johan Lindgren, from Lund University in Sweden, said: "It's amazing. Suddenly we get this idea of the colour of animals swimming around millions of years ago."

Completely dark

Until now, scientists have looked at the shapes of microscopic structures called melanosomes to determine the colour of dinosaur feathers and their "mummified" skin.

However, in this study, the researchers looked at the pigment held within these structures.

The team analysed three exquisitely preserved fossils: an 86-million-year-old giant predator called a mosasaur; a 55-million-year-old leatherback turtle; and a 190-million-year-old ichthyosaur - a deep-diving predator that looked like today's dolphins.

Image copyright Johan Lindgren Image caption Scientists found pigment inside the scales of an ancient mosasaur

Using chemical tests, the researchers found that dark traces on the animals' fossilized skin contained a type of melanin.

They believe the mosasaur, a vicious creature that would have terrorised the oceans, contained so much of this pigment, it would have been very dark in colour. The same was true for the ancient turtle that they examined.

"If you look at leatherhead sea turtles today, they have very dark skin with huge amounts of pigment," said Dr Lindgren.

"They use it to absorb the heat and light as they bask at the sea surface. And if we look at the fossil, we see masses and masses of melanin. There is a really good chance that this had a black skin or a really dark skin."

However, the team suspects these animals may have been lighter on their underside.

While a dark topside would have helped the animals to absorb as much energy as possible - as well as providing protection from ultraviolet light, a paler belly would have provided camouflage from any predators lurking below.

Image copyright Museum of Evolution, Uppsala Image caption The researchers say the ichthyosaur was dark on both its top and underside

A more complete fossil has enabled the team to establish the whole colour of the ichthyosaur - and they believe it would have been very dark or black all over.

"If you look at the ichthyosaur, they have been inferred as deep-diving because they have huge eyes. And we can see these animals had a uniform dark colouration - much like the modern sperm whale's colouration."

For many animals, colour is crucial for sexual signalling, for camouflage, or for warning... and so contributes hugely to the success of the evolution of the groups Prof Mike Benton, University of Bristol

The team believes this would have helped the deep-sea creatures to absorb as much energy as possible whenever they came up to the surface for air, and would have helped them to stay hidden in the darkness when they returned to the depths.

Mike Benton, professor of vertebrate palaeontology from the University of Bristol, said it was a fascinating discovery.

He told BBC News: "The new work enhances the field, and makes it more significant. At one time, reports of colour and patterns were a bit of a side line and always open to criticism. Now that a growing set of ultrastructural and geochemical tools is being tested, other teams are likely to jump in and use the methods on their fossils.

"Determining colour in an ancient organism is more than a smart trick. For many animals, colour is crucial for sexual signalling, for camouflage, or for warning - think of stripy snakes - and so contributes hugely to the success of the evolution of the groups."

Follow Rebecca on Twitter

You can hear more about this research on Science in Action on the BBC World Service and on Inside Science on Radio 4.