WICHITA, Kan. (KSNW) — When you think of Halloween decorations and symbols, probably one of the first images that comes to mind is the Jack-o’-Lantern.

Do you know how that tradition of carving a pumpkin and placing a candle inside began? We know its origins are in Ireland, but the legends and origins of the Jack-o’-Latern are a bit complicated.

According to National Geographic, the tradition of carving a face into vegetables and fruit dates back to early Celtic culture in Europe and symbolized the severed heads of enemies. It then became associated with the Samhain Eve celebrations which is the day before Samhain (pronounced “SOW-in” or “SAH-win”), a three-day celebration that makes the point between the Autumn Equinox and Winter Solstice, and the transition between longer and shorter days of the year.

Samhain Eve was thought to be the day when the dead could pass into the realm of the living. During Samhain in Ireland, it was thought that portals to the realm of beings often referred to as Faeries also opened up. Eventually, it became common in Ireland to carve turnips into small lanterns with a face, place a candle inside, and use it to ward off evil spirits when venturing outside.

Jessica Traynor writes for the Irish Times that Jack-o’-the-Lantern originally referred to ignis fatuus, the phenomenon of marsh lights that would confuse travelers, also referred to as Will-o’-the-wisp in Irish folklore. Slowly the idea of the natural phenomenon of Jack-o’-the-Lantern became associated with the turnip lantern.

Sometime around the 1600s folk stories began circulating detailing the origin of Jack-o’-the-Lantern, according to the Carnegie Museum of Natural History, Jack-o’-the-Lantern, used to be a man named Stingy Jack or Jack the Smith, Drunk Jack, Flakey Jack, and other names. Jack, tricks and traps the devil multiple times, each time only releasing him under the condition that the devil leave him alone for a specific amount of time.

However, when fate finally catches up with Jack, instead of taking his soul to Hell, the devil gives him a burning ember and curses him to roam the Earth for the rest of eternity. In other versions, Jack who is normally a stingy and unkind person, helps an angel disguised as an old man.

When the angel reveals itself, he grants Jack 3 gifts for his kindness. However, because Jack never asks to be allowed into Heaven, and/or his requests are purely selfish, the Angel bars him from ever entering Heaven. He also becomes barred from hell and is cursed to roam the Earth, barred from ever entering the afterlife.

It wasn’t until the tradition of Jack-o-the-Lantern came to America that the turnip was replaced with a pumpkin, during which the name became shortened to Jack-o’-Lantern. It switched in part because the pumpkin is only native to the Americas.

However, the pumpkin likely became ubiquitous with the Jack-o’-Lantern because of Washington Irving’s “The Legend of Sleepy Hollow.” In the story, the alleged headless spirit of the Hessian mercenary tosses a pumpkin at Ichabod Crane just as he crosses the bridge to safety.

Illustrations in later published editions would depict the pumpkin as a Jack-o’-Lantern. Irish immigrants to the United States, also found the pumpkin far easier the carve than the dense and tough traditional turnip.

From there, the tradition of carving pumpkins for Jack-o’-Lanterns became a Halloween tradition. According to the U.S. Department of Agriculture, it’s also a very profitable one.

Last year, over 1 billion pumpkins were harvested, producing over $134 million.