Between 2005 and 2007, the suburbs of Los Angeles, California, saw several avian casualties. The victims were 90-odd cedar waxwings and the cause of their death was drunk flying. The tipsy birds had accidentally rammed into windows, walls, and fencing – and died of trauma.

Before they met their tragic end, the birds had been feasting on the bright red berries of the Brazilian Peppertree. A post-mortem report on some of the birds revealed that their mouths, food pouches, and stomachs were full of whole berries and seeds. The birds had become so intoxicated by gorging on the naturally-fermenting berries that alcohol content in the liver of one reached 1,000 parts per million.

Overall, fruits make up about 84% of the waxwings' diet – but during the colder months, that is pretty much all they eat. Since fresh, ripe fruit is in short supply, especially during late winter and early spring, the birds occasionally encounter – and readily devour – over-ripe berries, and then end up drunk.

Birds are not the only animals to come across fermented produce out in the wild. Mammals, in particular, often feed on fruit, nectar and sap – all of which are rich in sugars that can ferment and be potentially intoxicating.

If animals consuming forest produce can get inebriated, does that mean our ancient forest-dwelling ancestors felt the effects of alcohol too? Has alcohol been a continuous presence throughout our evolution?

In 2000, Robert Dudley of the University of California in Berkeley proposed the idea of a deep historical link between fruit-eating animals and alcohol intake. With his curiously-titled "Drunken Monkey Hypothesis", Dudley suggested that our early ancestors were introduced to alcohol in fermenting fruit, and that this might underlie our current taste for it.

Fruit has formed an important part of the primate diet for perhaps 45 million years. Even though our more recent ancestors moved from a plant- to a meat-based diet about 2.6 million years ago, they continued to eat fruit. Our closest cousins – the chimpanzees – spend a lot of time feasting on fruits even today. Other primates like gorillas, orangutans and gibbons, relish fruits as well.

Alcohol likely shaped the evolution of fruit-eating primates for several million years

Ripe fruits ferment and decay because of yeast that grows inside and on the fruits. Yeast breaks down sugar into alcohol, primarily ethanol – the alcohol in beer and wine. As yeast cells multiply, the fruit sugar content decreases and ethanol content increases.

In studies published in 2002 and 2004, Dudley reported the alcohol content in wild fruits of the Astrocaryum palm, which Panama's mantled howler monkeys eat. The unripe fruits contain zero ethanol, ripe hanging fruits contain 0.6%, ripe fallen fruits contain 0.9% and over-ripe fallen fruits contain 4.5% ethanol (by weight) on an average.

In Dudley's view, such dietary consumption of alcohol likely shaped the evolution of fruit-eating primates for several million years. The ethanol wafting from fermenting fruits may have been a cue to locate sugary rewards in a vast forest. Besides, ethanol may itself be a source of calories and perhaps even stimulate the appetite.

Dudley's Drunken Monkey theory initially faced criticism on a couple of grounds.

One, primates prefer ripe fruits over rotting and the alcohol content of ripe fruits is so poor, it is not enough to get them "drunk". Two, if they do get drunk, balancing on trees under the influence of alcohol would be risky, particularly for babies. A third argument was that high-alcohol, low-sugar fruits should deter, rather than attract, primates. Added to that is the fact that primates had rarely been seen getting wasted on fermented fruits in the wild.

But these criticisms did not really get to the heart of Dudley's idea. His main argument was that our ability to digest alcohol is well-developed today because exposure to alcohol happened early on in our ancestory.

Digesting ethanol quickly would have been life-saving for our ancestors

Evidence of this can be seen in our genetic make-up. A study published in 2014 looked at evolution of an alcohol dehydrogenase enzyme named ADH4, which is one of many that break down alcohol in our bodies. Because it is present in the mouth, food pipe and stomach, ADH4 is the first such enzyme to face off with the alcohol we consume.

Matthew Carrigan of Santa Fe College in Gainesville, Florida, and his team found that a genetic mutation in our evolutionary past made ADH4 40 times better at breaking down ethanol.

The mutation was effectively ubiquitous in our ancestors by 10 million years ago, which might be significant. This is around the time that those ancestors started adapting to a terrestrial lifestyle and probably first encountered high ethanol content in fruits rotting on the forest floor. This point in prehistory also coincided with a period of climate change that saw forests in Africa shrink while grasslands expanded. In the new environments, fresh fruit would have been harder to come by.

Fallen, over-ripe fruit often lies uneaten for longer than the sought-after fresh and hanging ripe fruit, so it contains more ethanol. As the shift to a terrestrial life was underway, digesting ethanol quickly would have been life-saving for our ancestors, who were still spending half of their time climbing and swinging in trees some 10 to 20m above ground, says Carrigan.

So, an ADH4 that could better utilise alcohol-rich fruits would have been favoured in our evolution. Additionally, the calories in alcohol would have likely provided the extra energy required by our ape ancestors to move on the ground when their bodies were still adapted to living in trees.

The mutation in ADH4 also means that the enzyme in our more ancient, arboreal ancestors about 40 million years ago was bad at digesting ethanol – "stinking bad", as Carrigan puts it. This raises the question that, if ADH4's ability to deal with ethanol was dramatically improved 10 million years ago, what was it doing in the first place?

A long-term study spanning 17 years reported that wild chimpanzees booze on fermenting tree sap

"ADH4 in our very distant ancestors 40 million years ago was very good at metabolising a different alcohol called geraniol," says Carrigan. "And it turns out geraniol is not the only alcohol that the ancient ADH4 was good at metabolising. It also metabolised cinnamyl, coniferyl and anisyl alcohols. These alcohols have similar structures, are large hydrophobic alcohols, and as the name implies are found in geranium, cinnamon, conifer and anise plants."

These alcohols can be harmful if consumed in high concentrations, and are produced by plants to deter animals from eating their leaves.

"This makes sense because our arboreal ancestors 40 million years ago were eating leaves (and fruits). So being able to metabolise the chemicals in leaves would have been a really big advantage," says Carrigan. The exposure to ethanol would have been minimal for these ancestors as they had access to unfermented fruits, he adds.

Millions of years later, when ADH4 encountered ethanol in high concentrations in fermenting fruit, it adapted to digesting it really well. "It went from an enzyme that metabolised ethanol incredibly slow to one that metabolized ethanol 40-fold more efficiently," says Carrigan. This was due to a single tweak in the enzyme. This change in ADH4 that occurred 10 million years ago enabled the last common ancestor of humans, chimpanzees and gorillas to break down ethanol.

This finding certainly seems to back a key part of Dudley's theory that our alcoholic tendencies stem from our fruit-eating ancestors. It also shakes the idea that humanity's tryst with alcohol is fairly recent, dating back only about 9,000 years, to when humans first produced alcoholic beverages from grain, honey and fruit.

The wine is drunk by young and old, male and female chimps alike

Some other research indirectly supports Dudley's ideas too. For instance, in 2015, a long-term study spanning 17 years reported that wild chimpanzees booze on fermenting tree sap.

In the village of Bossou in Guinea, West Africa, locals crop the crown of mature raffia palms and hang plastic jugs to collect the sap dripping from it. The sugary sap soon ferments into alcohol, which is a popular drink among the locals. It is known as palm wine. On an average, the wine contains 3.1% ethanol (by volume) but it can go up to 6.9% depending on how long it is left to ferment.

While the wine is brewing, it can draw the attention of chimpanzees living or foraging nearby. The uninvited guests help themselves to the free drinks, with either an individual hogging the jug or two drinking buddies alternating their take, while others wait.

To get the wine, chimps use a tool: they crush some leaves in their mouth, dunk the leaves into the wine and put them back into their mouth to squeeze wine out, like a sponge. This way, the wine is drunk by young and old, male and female chimps alike – and they come back for more. Some even get tipsy.

Kimberley J. Hockings of Oxford Brookes University in the UK, writes in an email from Guinea-Bissau that, though she has not formally recorded the behavioural effects of alcohol, she did notice some signs of intoxication: chimps lying down or becoming agitated after drinking too much.

One 2016 study confirmed that two aye-ayes in captivity do have a taste for alcohol

The chimpanzees cannot tap the raffia palm on their own: they rely on the sap collection set-up prepared by villagers. But the study shows that they readily imbibe fermenting sap when it is available – and chimps are picky when trying new foods. The chimps also down the sap repeatedly in large quantities, which means it is not accidental but deliberate, habitual intake.

To be sure, the behaviour is rare. It was seen only in 50% of the local Bossou chimp population. The 13 remaining chimps were teetotallers, even though palm wine was available year-round.

The research did not put Dudley's ideas to the test. Whether the chimps use their sense of smell to home in on the wine or gain any nutritional benefit from drinking it, it does not show. But it does confirm that wild chimpanzees are not averse to alcohol.

Chimpanzees, like humans, have an efficient form of the ADH4 enzyme to metabolise alcohol, though it varies across populations. This is because we both inherited the modified gene coding for a faster version of the enzyme from a common ancestor. But there is one distant primate that acquired the same ADH4 mutation, independent of the lineage that led to us.

Aye-ayes split from our branch of the primate evolutionary tree 70 million years ago. We do not know when they acquired the same ADH4 mutation as us. But the fact that modern aye-ayes have it hints to a past where these animals too were exposed to alcohol. According to Carrigan, who carried out the work on ADH4 enzymes, if this was indeed the case, then aye-ayes might consume alcohol in the wild even today.

Indirect proof suggests they might. One 2016 study confirmed that two aye-ayes in captivity do have a taste for alcohol.

The animals did not show any obvious signs of inebriation

Aye-ayes are small, rather weird-looking primates with a thin and unusually long middle finger, which they use to locate and catch grubs in deadwood. But during the rainy season aye-ayes spend about 20% of their feeding time drinking nectar of the traveller's palm. Their long middle finger helps here too, in searching and scooping out the nectar.

It is believed that the nectar contained in bracts and flowers of the traveller's palm ferments. Though its alcohol content is yet to be established, the nectar is similar to that of another palm: the bertam palm. Bertam nectar contains up to 3.8% alcohol on natural fermentation by yeast. It gives out a strong whiff and is drunk by pen-tailed treeshrews, common treeshrews and slow lorises, among other mammals.

Samuel R. Gochman, a student at Dartmouth College in Hanover, New Hampshire, and his team offered aye-ayes a choice of liquid foods made of sugar water and varying concentrations of alcohol (0 to 5%). The two captive aye-ayes could differentiate between the different alcoholic foods. They preferred to drink from the containers with higher alcohol doses of 3 and 5% over those with 1% and zero alcohol.

When the containers holding higher alcohol contents had run out, the aye-ayes continued to compulsively dip and lick their fingers. "This suggests that they really like those concentrations," says Gochman.

But the animals did not show any obvious signs of inebriation, which goes back to their ability to breakdown alcohol because of a super-efficient ADH4 enzyme.

"Natural selection would favour this special ability because it allows these animals to access calories that would normally be toxic to other animals. Those organisms would avoid alcohol because it can impair judgement and is a chemical toxin," says Gochman.

Unlike aye-ayes, chimps and humans, other animals that consume ethanol do not necessarily have an ethanol-active version of ADH4. Take the common treeshrews that drink from the bertam palm,for instance. Their alcohol intake is considered potentially risky. How do they cut it? We do not know for sure.

Whatever allows these animals to tolerate the effects of alcohol, it is sobering to know that we are not the only habitual drinkers out there. And even if some of us are teetotallers, our ancestors were probably not.

Join over six million BBC Earth fans by liking us on Facebook, or follow us on Twitter and Instagram.

If you liked this story, sign up for the weekly features newsletter called "If You Only Read 5 Things This Week". A handpicked selection of stories from BBC Future, Earth, Culture, Capital and Travel, delivered to your inbox every Friday.