Image copyright Mary Evans Picture Library Image caption Goldfish and their relatives have the ability to turn lactic acid into alcohol

Scientists have decoded the secrets behind a goldfish's ability to survive in ice-covered lakes.

They've worked out how and why the fish turn lactic acid in their bodies into alcohol, as a means of staying alive.

Some goldfish were found to have levels well above legal drink-driving limits in many countries.

The researchers say the work may help with the study of some alcohol impacts in humans.

Scientists have known about the peculiar survival abilities of goldfish and their wild relatives, crucian carp, since the 1980s.

While humans and most vertebrates die in a few minutes without oxygen, these fish are able to survive for months in icy conditions in ponds and lakes in northern Europe.

Researchers have now uncovered the molecular mechanism behind this ability.

In most animals there is a single set of proteins that channel carbohydrates towards the mitochondria, which are the power packs of cells.

In the absence of oxygen, the consumption of carbohydrates generates lactic acid, which the goldfish can't get rid of and which kills them in minutes.

Image copyright SPL Image caption Alas, trying to get the alcohol out of the fish is a pointless pursuit

Luckily, these fish have evolved a second set of proteins that take over in the absence of oxygen and convert the lactic acid to alcohol, which can then be dispersed through the gills.

"The second pathway is only activated through lack of oxygen," author Dr Michael Berenbrink from the University of Liverpool, UK, told BBC News.

"The ice cover closes them off from the air, so when the pond is ice-covered the fish consumes all the oxygen and then it switches over to the alcohol."

The longer they are in freezing, airless conditions the higher the alcohol levels in the fish become.

"If you measure them in the field the blood alcohol goes up above 50mg per 100 millilitres, which is the drink-drive limit in Scotland and northern European countries," said Dr Berenbrink.

"So they are really 'under the influence'."

Despite the fact that the fish are literally filled to the gills with alcohol, it's not the drink that kills them. If the winter lasts too long, they run out of fuel that's stored in their livers and die.

The researchers say there are some very important lessons to be learned about evolutionary adaptation that produces a duplicate set of genes that allows the species to maintain their original function but also to keep the back-up set if it also delivers useful function.

"The ethanol production allows the crucian carp to be the only fish species surviving and exploiting these harsh environments, thereby avoiding competition and escaping predation by other fish species with which they normally interact in better oxygenated waters," said lead author Dr Cathrine Elisabeth Fagernes, from the University of Oslo, Norway.

"It's no wonder then that the crucian carp's cousin, the goldfish, is arguably one of the most resilient pets under human care."

Scientists have also calculated for fun, how long it would take to produce an alcoholic drink from the fish excretions.

"If you put them in a beer glass and closed them off, it would take 200 days to get it up to 4%," said Dr Berenbrink.

"In nature, it just would not happen."

The research has been published in the journal Scientific Reports.

Follow Matt on Twitter and on Facebook.