Conventional wisdom holds that Halloween is essentially a secular and pagan holiday, the result of the Christian Church appropriating an ancient Celtic harvest festival. But one strain of critical opinion tends to the view that the holiday was thoroughly Christian from the start.

In the church calendar, Halloween (All Hallows’ Eve) is the beginning of a triduum of holidays commemorating the dead, continuing with All Saints’ Day on November 1 and All Souls’ Day on November 2. It was common practice among the early Christians to commemorate the deaths of various martyrs at the places of their demise. In the 9th century Pope Gregory IV decided that the time had come for a single universal feast to commemorate all the saints, as well as a day to pray for one’s deceased loved ones. The pope chose a time of year—the end of harvest and the beginning of winter—when many people’s thoughts naturally turned to the idea of death.

The macabre aspects which have grown up around Halloween in modern times—the emphasis on witches, ghosts and other ghoulish figures, the glorification of gore and violence—have led many people to doubt its Christian character and many Christians to shun it. Yet according to some historians, these demonic elements of the holiday originated from a distinctively medieval Christian idea of exorcising evil by ridiculing it. Christian theology holds that Jesus conquered sin and death; and death loses its sting precisely when one is able to laugh at it.

For an example, look to the Gothic cathedrals built during the height of the Middle Ages. They soar heavenward in praise of God; yet in the nooks and crannies you will find grotesque gargoyles, dragons and devils. Such iconography served to remind medieval people of the reality and presence of evil, but also to make light of it, illustrating the idea that evil is swallowed up in Christ’s Resurrection.

The grotesque side of Halloween originated in part from medieval pageants like the “dance of death,” in which Death in the guise of a skeleton visited people from various walks of life and dragged them to the grave. Such artistic representations served as a memento mori—a reminder that death comes to all.

Some of the holiday’s ghostly elements are no doubt a spillover from All Souls’ Day, known as Día de Muertos in Mexico, where it is a major occasion involving memorial altars and visits to the graves of loved ones with gifts. It was a widespread folk belief that the veil between heaven, hell and purgatory is thinnest during this time, with the result that spirits might be seen walking about.

Driving home the connection between Halloween and Christ, one Roman Catholic writer ties it in with the feast of Christ the King, celebrated in November. The feast celebrates Jesus’ eternal lordship—the idea that all things, including sin and death, have been placed under his feet. Since this feast reflects the glory of the Resurrection and Easter, perhaps it’s not a stretch to say that the feast of Halloween is a kind of lesser, comic reflection of Good Friday, in which evil does its final dance before being destroyed by Christ.

The verdict is clear: Halloween has ultimately more to do with the Holy Ghost than with ghosts and ghouls. It’s worth remembering, as we take part in masquerades and carve pumpkins and watch horror movies, that there are deeper dimensions at work in this lighthearted holiday having to do with sin, death, and new life.

This article originally appeared on Intellectual Takeout in 2017.