The origin of Halloween is typically linked to the Celtic festival of Samhain, derived from the Old Irish Samuin meaning "summer's end". Samhain was the first and the most important of the four quarter days in the medieval Irish and Scottish calendar and, falling on the last day of autumn, it was a time for stock-taking and preparation for the cold winter months ahead.
There was also a sense that this was the time of year when the physical and supernatural worlds were closest and magical things could happen. The souls of the dead were supposed to revisit their homes on Samhain eve. To ward off these spirits, the Gaels built huge, symbolically regenerative bonfires and invoked the help of the gods through animal and perhaps even human sacrifice.
In the Western Isles of Scotland the Slaugh, or fairy host was regarded as composed of the souls of the dead flying through the air, and the feast of the dead at Hallowe'en was likewise the festival of the fairies.