Nearly 140 child skeletons were revealed at the site last year. And now researchers say it may have been a response to an El Niño event.

Last year archaeologists in Peru announced the discovery of a centuries-old ritual massacre, at a site they believed was the largest known case of child sacrifice ever found.

Buried beneath the sands of a 15th-century site called Huanchaquito-Las Llamas were nearly 140 child skeletons, as well as the remains of 200 llamas.

While the reasoning behind the gruesome mass murder of the boys and girls — who were only between the ages of 5 and 14 — cannot be definitively determined, the researchers now say the act was done out of desperation in response to a disastrous climatic event: El Niño.

“What we seem to have at Huanchaquito-Las Llamas is a sacrifice to stop torrential rains, flooding and mudflows,” said John Verano, an anthropologist at Tulane University and an author of the paper, which was published Wednesday in PLOS One.

The finding provides insight into the rituals of the ancient Chimú civilization that inhabited Peru’s northern coast. It also attempts to piece together the story behind why people murdered these children, presumably by cutting open their chests and ripping out their hearts.

One day in 2011 a man named Michele Spano Pescara approached Gabriel Prieto, an archaeologist at the National University of Trujillo in Peru. He said that his children had dug up bones near his home. When Dr. Prieto followed the man to the site, he was astonished.

“There were so many complete human remains and complete bodies in perfect states of preservation everywhere,” said Dr. Prieto, who led the study.

Dr. Prieto called in a colleague, Katya Valladares, who investigated the skeletons and identified cut marks on many of the children’s sternums. That indicated that the burial site was not a group cemetery, but ather the location of an orchestrated killing event.

From 2011 to 2016, Dr. Prieto and his colleagues dug up 137 complete child skeletons and the remains of more than 200 llamas in an area that stretched about 7,500 square feet.

Some bodies had been buried in cloth, some wore cotton headdresses and others had red-cinnabar paint preserved on their skulls. Buried beside many of the victims were young llamas, each less than 18 months old. They too were sacrificed. The team noticed that the children were buried facing west to the coast while the llamas faced east to the Andes Mountains.

Using radiocarbon dating, the site was dated to about 1450 A.D., which placed it at a time before the neighboring Inca empire invaded. The team also attempted to collect DNA from the teeth of some victims but were only successful in a fraction of cases. What they got was enough to tell them that both boys and girls were present, meaning the sacrifice wasn’t gender specific. Further DNA analysis could help determine whether the children were local or if they came from across the Chimú state, but based on some morphological details the team thinks the victims came from around the empire.

A major clue to figuring out why the Chimú sacrificed the children came in the form of a thick mud layer preserved on top of the sand where the victims were buried. Because the area is a desert, the mud layer indicated there was once a period of heavy rain, like that seen during an El Niño, or a natural warming of the Pacific Ocean’s surface waters that has cascading effects on the weather. Such a deluge would have devastated the Chimú state, flooding crops, killing fish and sweeping people away.

Also in this mud layer, the scientists found preserved footsteps of sandaled adults and barefoot children, as well as signs that the llamas were dragged there. The children, it appeared, were marched to the site, which was just on the outskirts of the Chimú capital city, Chan Chan. The killings, the authors suggest, were done at the order of the Chimú state as an appeal to their gods or ancestral spirits to mitigate the rains.

“The picture that starts to emerge is that under conditions of severe climatic disruption, the sacrifice of children may have been the most powerful means of communication with the supernatural,” said Haagen Klaus, a bioarchaeologist from George Mason University in Virginia not involved in the study.

Tiffiny Tung, a bioarchaeologist at Vanderbilt University also not involved in the study, said that in addition to illuminating the Chimú’s rituals, the finding provides a look into the state’s political machinery. The sacrifice, she said, would have let the Chimú leaders demonstrate to their people the lengths to which they would go to appease the deities and protect the community. At the same time, carrying out such a massive slaughter of children would have been a reminder of the leaders’ power and authority over their citizens.

“That’s a great way to get people to step in line,” she said.