Xipe Totec is a god of agricultural renewal. Worshipped with human sacrifice, his priests wore the victims’ skins as ceremonial attire. Statues and carvings of Xipe Totec have turned up at archaeological sites scattered all over Mexico and Central America, but archaeologists with Mexico’s National Institute of Anthropology and History (INAH) say they’ve found the first known temple dedicated to the god. Preliminary dating suggests the temple saw use from 1000 to 1260 CE, which suggests that it was built before the rise of Aztec culture.

A team led by archaeologist Noemí Castillo Tejero excavated the basement of a pyramid at a temple complex in Puebla state in south-central Mexico, where previous seasons’ excavations had found damaged sculptures of Xipe Totec on a pair of altars out front. Inside, they found two sacrificial altars, a small ceramic statue of the god, and two massive carved skulls that they say also represented the skinned face of the Flayed God.

While this is the first temple to Xipe Totec that archaeologists have studied, documents from the Aztec period describe the annual spring ritual of Tlacaxipehualiztli, or “to wear the skin of the flaying.” In these ceremonies, priests sacrificed captive slaves to Xipe Totec, then carefully skinned their bodies and wore the skins to carry out 20 days of rituals.

Aztec writings say Xipe Totec removed his own skin in order to provide food for humanity, the way a maize kernel loses its protective outer layer before sprouting. And twenty days later, the god emerged, reborn, from the rotting remains of his own skin. And that’s how such a macabre image came to be associated with rebirth and agriculture—and how a god worshipped with annual human sacrifices also found a place in household shrines, like the one INAH archaeologists found in Hidalgo state in central Mexico in 2009. People in Mesoamerica began worshipping Xipe Totec before the Aztecs’ rise to power around 1300, but the Aztec culture helped spread this practice throughout the region.

The layout, architecture, and statues of the temple found in Puebla match descriptions in written sources: a pair of round sacrificial altars, each about 3 meters (9.8 feet) wide and 78 to 88cm (2.5 to 2.8 feet) high, where captives would have been killed and had their hearts removed before the meticulous ritual skinning. The 85cm (2.8ft) statue resembles other representations of Xipe Totec. He appears wearing sandals, a feather skirt, and the flayed skin of a human sacrifice—or perhaps he is emerging from his own flayed skin. At the end of the statue’s left arm, a right hand hangs loose, dangling like the end of a sleeve, and on the statue’s back, colored finishing suggests a cloak of flayed human skin, and its granular texture suggests decay. A round hole in the statue’s stomach would have held a green stone, which, according to Castillo Tejero and her colleagues, would have brought the god’s statue to life for ceremonies in his honor.

This particular statue is missing its head and most of its legs, but other sculptures of Xipe Totec generally show the god with long hair and a hole in his ear lobes. Why was this statue missing its head? Castillo Tejero and her colleagues say that it, along with the pair of carved stone skulls, had been ritually “killed,” or broken, which was usually a way of deconsecrating a statue or temple so it could be replaced.

For the pair of 70cm (27.5in) tall stone skulls, that ritual execution took the form of a series of cuts across their noses. The skulls, each weighing about 200kg (441 lbs), once stood watch over holes dug in front of the sacrificial altars, where the skins of the dead would have been interred. They’re both carved from volcanic rock, most likely rhyolite, which must have been imported, since it isn’t found naturally in the region.