By Nick Davidson
Two thousand years ago, a mysterious and little known civilisation ruled the northern coast of Peru. Its people were called the Moche.
The largest pyramid constructed by the Moche, the Huaca del Sol
They built huge and bizarre pyramids that still dominate the surrounding landscape; some well over 30m (100ft) tall.
They are so heavily eroded, they look like natural features; only close up can you see they are made up of millions of adobe mud bricks.
These pyramids are known as "huacas", meaning "sacred site" in the local Indian dialect. Several contain rich collections of murals; others house the tombs of Moche leaders.
As archaeologists have excavated these Moche sites, they have unearthed some of the most fabulous pottery and jewellery ever to emerge from the ancient world.
The Moche were pioneers of metal working techniques such as gilding and early forms of soldering.
Archaeologist Dr Walter Alva with an elaborate Moche ear ornament
It enabled them to create extraordinarily intricate artefacts; ear studs and necklaces, nose rings and helmets, many heavily inlaid with gold and precious stones.
Archaeologists have likened them to the Greek and Roman civilisations in Europe.
But who were these extraordinary people and what happened to them? For decades the fate of the Moche has been one of the greatest archaeological riddles in South America.
Now, at last, scientists are coming up with answers. It is a classic piece of archaeological detective work.
This week's Horizon tells the story of the rise and fall of a pre-Inca civilisation that has left an indelible mark on the culture and people of Peru and the central Andes Mountains.
One of the first important insights into this remarkable culture came in the mid-1990s when Canadian archaeologist Dr Steve Bourget, of the University of Texas in Austin, made a series of important discoveries.
Excavating at one of the major Moche huacas - a site known as the Huaca de la Luna - he came across a series of dismembered skeletons that bore all the signs of human sacrifice.
He also found that many of the skeletons were so deeply encased in mud the burials had to have taken place in the rain.
Archaeologist Luis Jaime Castillo holds a Moche ceramic depicting warriors engaged in ritual combat
Yet in this part of Peru it almost never rains; it could not have been a coincidence. Bourget speculated that the Moche, like many desert dwelling peoples, had used human sacrifice to celebrate or encourage rain.
The theory appeared to explain puzzling and enigmatic images of human sacrifice found on Moche pottery; it provided a new insight into Moche society; yet it did not explain why this apparently sophisticated civilisation had disappeared.
Then American climatologist Dr Lonnie Thompson, of Ohio State University, came up with a startling new find. Using evidence from ice cores drilled in ancient glaciers in the Andes, he found that at around AD 550 to 600, the coastal area where the Moche lived had been hit by a climatic catastrophe.
For 30 years the coast had been ravaged by rain storms and floods - what is known as a Mega El Niño - followed by at least 30 years of drought. All the human sacrifices in the world would have been powerless to halt such a disaster.
It seemed a plausible explanation for the demise of a civilisation.
But then in the late 1990s, American archaeologist Dr Tom Dillehay revisited some of the more obscure Moche sites and found that they dated from after AD 650.
Many were as late as AD 750, 100 years after the climatic double-whammy. He also found that at these later settlements, the huacas had been replaced by fortresses.
Thompson's ice cores have opened up the climate history book
The Moche had clearly survived the climatic disaster but had they then been hit by an invasion? Dillehay cast around but could find no evidence for this.
He now put together a new theory, one that, in various guises, is now widely accepted by South American experts.
The Moche had struggled through the climatic disaster but the leadership - which at least in part had claimed authority from its ability to determine the weather - had lost authority and Moche villages and/or clan groups had turned on each other in a battle for scarce resources such as food and land.
Moche society had pulled itself apart.
Horizon is broadcast on BBC Two on Thursday at 2100 GMT.