The origin of the pumpkin jack o lantern is found in Celtic Ireland and has always been wrapped up in Halloween, a festival known in the Irish language as Samhain.
This festival marked the end of the Celtic year and was a night when the departed returned to their former homes, and other vengeful spirits and bad fairies wandered the Earth.
In order to prevent unwelcome guests entering their homes at Samhain, the Celts created menacing faces out of turnips and left them on their doorsteps. Adding a lit candle to the hollowed out face gave added protection.
In modern times, pumpkins are used. They're considerably easier to carve, and a lot bigger, too, but they are not native to Ireland.
According to legend, the origin of the Halloween lantern can be found in the tale of a young blacksmith called Jack O'Lantern who made a pact with the Devil during a gambling session. He managed to thwart the Devil and extracted a promise from him that he would never take his soul.
When he eventually died, Jack was refused entry to heaven on account of his drunken, lewd and miserly ways. The Devil, remembering his earlier promise, also refused to allow him into hell. So Jack was condemned to roam the dark hills and lanes of Ireland for eternity.
His only possessions were a turnip with a gouged out centre and a burning coal, thrown to him by the Devil. He put the coal inside the turnip to light his way through the dark countryside where he still wanders......
Halloween 'trick or treating'
seems to have been a Druid ritual of collecting eggs, nuts and apples from the
individual homes of the community.
These offerings were meant to bring some protection from bad luck such as damage to crops or livestock in the next year. Those that were miserly in their offerings were likely to have a trick played on them.
These pranks were harmless enough. They were intended to cause confusion more than anything else. This was (and still is, in some parts of Ireland), the night when the opening direction of a gate might mysteriously change. Or when street signs might 'spin' during the dark hours and end up pointing the wrong way. The latter is not, unfortunately, confined to Halloween!