Pterosaurs, the flying relatives of dinosaurs, had feathers and were able to control their colours, palaeontologists have discovered.

It had been known that pterosaurs had fluffy coats consisting of hair-like fibres, but whether these were true feathers had been debated.

The new study, based on analyses of a 115 million-year-old fossilised headcrest of the pterosaur Tupandactylus from Brazil, found two types of feather.

The bottom of the crest had a fuzzy rim of feathers, with short wiry hair-like feathers and fluffy branched ones.

Pterosaurs lived side by side with dinosaurs, 230 to 66 million years ago, and the new findings shed light on the early evolutionary history of feathers.

University College Cork (UCC) palaeontologist Dr Aude Cincotta said: “We didn’t expect to see this at all.

“For decades palaeontologists have argued about whether pterosaurs had feathers.

“The feathers in our specimen close off that debate for good as they are very clearly branched all the way along their length, just like birds today.”

With the soft tissue well preserved, the team were able to examine the fine detail of pigment-producing structures known as melanosomes.

Unexpectedly, they found the melanosomes in different feather types have different shapes.

Professor Maria McNamara, from UCC, said: “In birds today, feather colour is strongly linked to melanosome shape.

“Since the pterosaur feather types had different melanosome shapes, these animals must have had the genetic machinery to control the colours of their feathers.

“This feature is essential for colour patterning and shows that coloration was a critical feature of even the very earliest feathers.”

The findings also suggest that although these feathers may not have been used for flight, they might have been used as a form of visual communication.

The study, published in the journal Nature, was led by UCC palaeontologists Dr Cincotta and Prof McNamara and Dr Pascal Godefroit from the Royal Belgian Institute of Natural Sciences, with an international team of scientists from Brazil and Belgium.