Every 14th day of Adar on the Hebrew calendar Jewish people celebrate Purim. It’s a joyous holiday that marks the time the Persian Jewish population was saved from genocide. Okay, while Purim does have rather dark underpinnings, it really is supposed to be a fun celebration of survival full of wine, noisemakers and hamantaschen – the triangle cookie-like pastry with filling. Here’s the story behind Purim’s favorite treat.

Written in the Old Testament’s Book of Esther, the Purim saga starts in 4th century Ancient Persia. King Ahasuerus (historically, this may have been King Xerxes I) was on the lookout for a new queen after executing his first one (yeah, this story gets pretty grim). After a long search, he chose a beautiful woman named Esther, who happened to be Jewish but did not divulge this to the King. Meanwhile, the king appointed a wealthy businessman named Haman to be the prime minister. For reasons that are rather complicated and not at all hamantaschen-related Haman wanted to rid the kingdom of the Jewish people.

Now, Esther had a cousin Mordechai and one day he overheard Haman explain his horrific plan to a minion. Mordechai was a leader in the Jewish community, having alerted the King to an assassination plot years earlier and already on Haman’s bad side by refusing to bow down to him. Mordechai relayed Haman’s scheme to Esther and implored her to get the King to put a stop to this. Knowing full well the King’s history with queens, she was frightened but told the king of Haman’s genocidal intent anyway. The King is furious with Haman and has him hung. In his stead, the King mad Mordechai prime minister. The Purim story ends happily ever after with Esther and Mordechai celebrated as heroes and Haman as the foiled evil villain.

It’s a long-held belief that the three corners of the triangle-shaped hamantaschen represent Haman’s favorite three-cornered hat. Supposedly, taking a bite out of the cookie is in defiance of bowing down to Haman and preventing him from carrying out his evil plan. Further research, though, reveals that the hamantaschen wasn’t about Haman’s hat at all.

While original Purim celebrations have always included food, feasting and wine, it was another type of cookie – the “ozen Haman” – that was popular. While today it’s sometimes thought to be interchangeable with hamantaschen, it’s actually a completely different pastry. According to haaretz.com, the first written reference to these rounded deep fried cookies dipped in honey come from a 16th century comedy play entitled “A Comedy of Betrothal,” a play that satirized the religious leaders’ habits of looking for biblical references to explain new traditions. Others have translated “ozen Haman” to mean “Haman’s ears,” a reference to King Ahasuerus cutting off Haman’s ears prior to having him hung. While “ozen” can mean ears, chabad.org points out that “oznayim” was often used in Eastern European cultures to describe pastries in general. It also noted that there’s no biblical record of the King cutting off Haman’s ears, but rather this was a practice more common during the Middle Ages.

The hamantaschen actually did not emerge in Jewish culture until much later, perhaps as recently as the beginning of the 19th century. Starting in the late 18th century, a popular treat throughout Europe was the “Mohntaschen,” which is loosely translated from a Yiddish-German dialect to mean “poppy pocket.” A folded, triangle, doughy cookie filled with poppy seed paste, the pastry was eaten by all sects of the population. Considering the Jewish people’s preponderance to eat pastries on Purim and the word “mohn” sorta sounding like Haman, many scholars believe this is how the word “hamantaschen” came to be.

Today, hamantaschen can be found filled with fruit, nuts, chocolate as well as the more traditional “mohn,” or poppy seed paste. This Purim, try a hamantaschen, but remember it has nothing to do with a hat or severed ears.