In 1891, the palaeontologist Erwin Barbour was walking through the White River Badlands of western Nebraska; a mosaic of parched grassland and slow-flowing rivulets that expose colourful layers of sedimentary rock. He was there to inspect a fossil that had baffled a local rancher.
After being led to the fossil's location, Barbour found himself just as puzzled. The fossil looked like a two-metre-tall corkscrew of stone, spiralling vertically into the landscape. It was like nothing he had seen before.
What was it? Barbour, head of the Department of Geology at the University of Nebraska, decided the fossil must be the remains of an extinct freshwater sponge, which he named Daemonelix or "Demon's corkscrew".
A couple of years later he was forced to rethink his conclusion. Other fossils from the same site did not fit with the idea that an ancient lake once covered the area. Barbour decided that Daemonelix was really the preserved root system of a giant tree. This was also wrong.
There were dozens of beaver species in all manner of forms and sizes, from blind burrowers to Ice Age giants
Thankfully, his contemporaries had other ideas. Edward Drinker Cope and Theodor Fuchs independently noticed that, inside a horizontal compartment preserved at the base of the helical fossils, were the ancient bones of a rodent. The devil corkscrews were not the remains of an extinct organism. They were ancient burrows that filled up with sand and silt.
In 1906, the rodents were identified as beavers that lived at the bottom of their deep, vertical burrows 22 million years ago, venturing above ground to feed on the lush steppes of North America. They were named Palaeocastor, literally meaning "prehistoric beaver". But they were not the only beavers of prehistory.
In fact, in times past the beaver family tree dripped in diversity. There were dozens of beaver species in all manner of forms and sizes, from blind burrowers to Ice Age giants. Today, though, that tree has been gnawed and stripped of most of its branches. Just two species remain. How and why did the beavers rise – and what precipitated their spectacular fall?
With incisors that renew throughout life, beavers are part of an early radiation of rodents that emerged between 40 and 35 million years ago. At this time, the warm and wet greenhouse world of the Eocene period was beginning to cool.
As a palaeontologist who studies rodents, I study everything's lunch
The forests of the Arctic receded southwards and the thick canopy was reduced to a carpet of grass. Rodents took full advantage, filling nearly every ecological niche available. Small and nimble, they ran, climbed, and bred into new lifestyles.
But beavers took a different tack. "From their origin they're pretty big," says geologist Samantha Hopkins of the University of Oregon in Eugene. This came at a cost.
"Rodents in general are made for everything else to eat," says Hopkins. "As a palaeontologist who studies rodents, I study everything's lunch." Their greater size meant that ancient beavers would have been particularly tempting targets for the predators of yore.
To take themselves off the menu, they hid. Soon after their emergence in North America, the beaver family tree split in two. One branch took to the water and the other went underground.
It sounds contradictory today, but early in their evolution beavers really benefited from a lack of trees.
"They were some of the first animals to take advantage of open habitats," says Joshua Samuels of East Tennessee State University. "They really dove right into it."
In addition to the Palaeocastor fossils discovered in Nebraska, there were at least 15 species of beavers digging their homes into the soft sandy ground of North America between 32 and 20 million years ago. At one site called the Harrison Formation in South Dakota, there were no fewer than eight species living similar lives, in the same place and at the same time.
Early in their evolution beavers really benefited from a lack of trees
"They were some of the most abundant animals in basically all the places they lived in North America," says Samuels. "A prairie dog town is a good analogue… They were very, very common."
Their ubiquity might even explain why some beavers dug such odd vertically-spiralled burrows. As Larry Martin and Debra Bennett of the University of Kansas concluded in 1977: "The high density of the burrows… permits the digging of a very deep vertical burrow which occupies little horizontal space." Like our tower blocks, the burrows were an adaptation to city life.
From the distinctive marks they left on the inside of helical burrows, Martin and Bennett also demonstrated that these beavers dug with their protruding teeth, not with their claws as was previously assumed. They wrote: "when scraped through soft, moist sand they leave a broad flat groove with a slight ridge down the centre where the incisors do not quite meet."
Out of the 500 fossil burrows they examined, 50% twisted in a clockwise direction and 50% were anticlockwise, opening up the possibility that some beavers were right-toothed and some left-toothed.
While Palaeocastor dug with its teeth, other species used their strong front limbs and flattened heads as shovels.
One group, known as Euhapsis, became so attuned to a life underground that they may have become blind. Certainly, their skulls show all the signs. "[They have] a reduced optic canal, and an anatomy that points to it being really a subterranean animal like blind mole-rats," says Samuels.
The last of the burrowing beavers literally dug their own graves 20 million years ago
Unlike the beavers that left the comfort of their home to feed on the grasslands above, Euhapsis would have fed on bulbous roots and tubers underground, never seeing or sensing the Sun above. Both life and death were dark.
Specialisation may have been the reason for the burrowing beavers' downfall, says Samuels. Being specialised tends to mean a species has a short "lifespan", because a sudden environmental change can remove the conditions that the specialism is best suited for.
As the climate chilled still further, and competition from other burrowing animals such as gophers and prairie dogs intensified, Palaeocastor and its kin went extinct. The last of the burrowing beavers literally dug their own graves 20 million years ago.
But as their burrowing cousins were dwindling, the semi-aquatic beavers boomed.
Sheltered from the worst of the weather within their watery habitats, they spread across North America, Europe and continental Asia. They often moved back and forth across the Bering land bridge between Canada and Russia.
Rodents typically breed like rabbits, pumping out lots of offspring
One of the most exploratory was Steneofiber, a smaller version of modern-day beavers that swam and wandered across all three northern continents, using its long legs and feet for propulsion.
Just like the two beaver species alive today, Steneofiber had a sharpened claw on its hind foot. This would have been used for grooming its dense fur, and for spreading waterproofing oil called castoreum, which the beaver secreted from two sacs next to its genitals.
In 1995, researchers reported the discovery of a collection of 10 Steneofiber skeletons, all huddled together. Two were much larger than the rest, three had their first replacement teeth, and the other five were all tiny. It was a fossilised family of differing ages.
As early as 24 million years ago, as the burrowing beavers were dwindling, Steneofiber parents were investing heavily in their young "kits", making sure that they had the best chance at survival. It is the evolutionary equivalent of quality over quantity, and it pushed the semi-aquatic beavers further away from the norms of rodent-hood.
Rodents typically breed like rabbits, pumping out lots of offspring in the hope that a few will survive by sheer chance. Steneofiber did not.
Instead, as the temperature continued to drop, families of different age groups huddled together for warmth. They may have dug burrows into riverbanks, or built lodges as safe houses.
Ice repeatedly spread far from the poles, covering much of North America, Europe and Asia
Even dams are not out of the question, says Samuels – although such assemblies of wood, mud, and moss rarely fossilise. The earliest dams yet found hail from three million years ago, uprooted from the peat bogs of a site called Beaver Pond on Ellesmere Island, Canada. The interwoven masses of sticks show the hallmark tooth marks of a semi-aquatic beaver species known as Dipoides.
And Dipoides was not the only ecosystem engineer. By 10 million years ago, the modern beavers of the Castor genus had evolved and were spreading from their origin in eastern Asia. With lodges, dams, and caches of food underneath the water's surface, these beavers insulated themselves from harsh winters.
Those winters would only get longer and colder.
The Pleistocene epoch – the period in Earth's history that began around two million years ago – can be defined by two main features. First, it was so cold that ice repeatedly spread far from the poles, covering much of North America, Europe and Asia. Second, mammals grew to mammoth sizes.
Some were literally mammoths. These woolly cousins of elephants roamed North America and Eurasia alongside whopping cave bears, giant sloths, and saber-toothed cats. They left footprints that their relatives living today cannot fill.
It would have been a very awkward animal when on land
Beavers were no different. Weighing over 200kg and measuring up to 10ft (3m) from goofy tooth to tail, the giant beaver Castoroides was about the same size as a black bear.
"It was like a beaver on steroids," says William Korth of the Carnegie Museum of Natural History in New York.
But size was not its only defining feature. Compared to modern Castor beavers, the giant beaver's tail was less paddle-like, and its hind legs and feet were much larger relative to its overall size. It was a big-foot beaver.
"It would have been a very awkward animal when on land," says Samuels. "But in the water it would have been an amazing swimmer, more reminiscent of something like a seal or a sea lion."
Did the giant beaver cut down giant trees, build vast dams, and trap huge volumes of water for its food and protection? A jumble of fossilised sticks from Canada, each apparently cut by Castoroides' banana-sized incisors, suggests so.
"Although they were not preserved in a dam-like structure, they occur in a cluster that looks very similar to what might be a dam," says Korth.
Perhaps Castor beavered better than any other beaver had before
Today the giant beaver is no more. Along with most of North America's mega-sized animals, its branch was cut short at the end of the most recent glacial period, 10,000 years ago.
Did the world's climate change too fast? Did humans, who arrived in North America just a few thousand years before, ambush this awkward animal too often? Both are certainly possible, but there is an alternative explanation.
Castoroides was just one of many beavers to go extinct over the last 10 million years. Others include Dipoides, Steneofiber and another giant beaver from Europe called Trogontherium. It is possible that it was competition from the beavers that survive today – species in the genus Castor – that sealed the fate of the others.
Perhaps Castor beavered better than any other beaver had before.
It is a story that sounds oddly familiar to our own. In former times, the human family tree was vigorous and healthy, with many species spread across Europe, Asia and Africa – including the Neanderthals, "hobbits" and the mysterious Denisovans. But today only our species, Homo sapiens, remains.
They were hunted for their thick fur, meat and castoreum, which is used in medicine and perfume
"[Perhaps] beavers have done something similar," says Hopkins. "The ecological role they evolved in the genus Castor may have filled the space that other species were in everywhere else. They sort of booted themselves out." For now, though, this is only an idea.
Today there are only two species of beaver alive– the Eurasian and American – but both carry echoes of the formerly-grand beaver family tree.
Both species burrow into river and lake banks, just like Palaeocastor dug into the vast steppes of North America 22 million years ago. Both live in close-knit family groups like Steneofiber, caring for their kits until they reach adolescence.
Both are massive, for rodents; a reminder of the giant Ice Age beaver Castoroides. Only one rodent alive today is larger: South America's guinea-pig-like capybaras.
And both have had a brush with extinction. They were hunted for their thick fur, meat and castoreum, which is used in medicine and perfume, and were critically endangered by the 18th Century.
The problem was particularly acute in Europe.
The Eurasian beaver is now listed as "least concern" by the International Union for Conservation of Nature
By 1526, beavers were extinct in Britain. In many other European countries – Austria, Belgium, Estonia, Finland, Hungary, Latvia, the Netherlands, Poland, Sweden, and Switzerland – the last beaver was trapped and killed by the 19th Century.
From an original stock of up to 400 million, the Eurasian beaver was reduced to just 1,200 individuals, isolated and vulnerable in eight out-of-touch populations.
In 1845, Norway introduced the first moratorium on hunting. Beavers started to rebound. Thanks to reintroductions in 25 European countries, the species has now reclaimed much of its former range.
With an estimated population of 639,000 individuals, the Eurasian beaver is now listed as "least concern" by the International Union for Conservation of Nature, as is its American cousin. But that is an overall view. Some isolated populations are still struggling.
In particular, the Sino-Mongolian beaver can only be found within the Ulungur watershed, which sprawls across China and Mongolia. This is "an area little known to people outside this region," according to Hongjun Chu and Zhigang Jiang of the Chinese Academy of Sciences.
Living under the shadow of Mount Altay and stretching into the deserts of Gurbantunggut and Gobi, this precarious population faces an onslaught of challenges.
The Eurasian beaver was reduced to just 1,200 individuals
For one, it is a harsh and unforgiving climate. The winter is six months long, and frost extends its icy touch far into the other seasons. Temperatures range from 34C above freezing to 50C below.
Of the little precipitation that falls, 33% is snow. Even when rain does fall, 90% evaporates into the thin high-altitude air.
Then there are the neighbours. The number of human settlements has more than doubled in the Ulungur watershed since 1989, and the population has increased by 71%, according to surveys taken in the 1980s and 2000s.
What's more, the local Mongol, Kazak, Han, and Uygur people are increasingly relying on wood-burning stoves for energy. This means they are competing with beavers for Poplar trees.
The Sino-Mongolian beaver population is "partially protected" by the Bulgan Beaver Nature Reserve. But Chu and Jiang say more needs to be done to protect the beavers, and to help the local people find alternative energy sources.
So while Eurasian beaver populations elsewhere are enjoying a resurgence, the future for these beavers of the desert is less clear. With the right care and attention, they might trundle on. Or they could soon join their ancient relatives, becoming just another branch that has been gnawed off the beaver family tree.
Join over five 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 bbc.com features newsletter called "If You Only Read 6 Things This Week". A handpicked selection of stories from BBC Future, Earth, Culture, Capital, Travel and Autos, delivered to your inbox every Friday.