The Catholic Church played a leading role in the early history of the pretzel. In the seventh century, the church dictated stricter rules governing fasting and abstinence during Lent than it does today. Pretzels, made of a simple mixture of water, flour and salt, were an ideal food to consume during Lent, when all types of meat, dairy and eggs were prohibited.

The first pretzels were baked as a soft, squishy bread, like the soft pretzels of today. Some say they were originally called “bracellae,” the Latin term for “little arms,” from which Germans later derived the word “bretzel.” According to others, the earliest pretzels were dubbed “pretiolas,” meaning “little rewards,” and handed out by the monks when their young pupils recited their prayers correctly. Whatever they may have been called, the popularity of these twisty treats spread across Europe during the Middle Ages. Seen as a symbol of good luck, prosperity and spiritual fulfillment, pretzels were also commonly distributed to the poor, as a way of providing them with both spiritual and literal sustenance.

Pretzels—or those who made them—took a particularly dramatic turn in the spotlight in 1510, when Ottoman Turks attempted to invade Vienna, Austria, by digging tunnels underneath the city’s walls. Monks baking pretzels in the basement of a monastery heard the enemy’s progress and alerted the rest of the city, then helped defeat the Turkish attack. As a reward, the Austrian emperor gave the pretzel bakers their own coat of arms.

By the 17th century, the interlocking loops of the pretzel had come to symbolize undying love as well. Pretzel legend has it that in 1614 in Switzerland, royal couples used a pretzel in their wedding ceremonies (similar to how a wishbone might be used today) to seal the bond of matrimony, and that this custom may have been the origin of the phrase “tying the knot.” In Germany—the country and people most associated with the pretzel throughout history—17th-century children wore pretzel necklaces on New Year’s to symbolize good luck and prosperity for the coming year.

When did pretzels make their way to America? One rumor has it that the doughy knots came over on the Mayflower, and were used by the Pilgrims for trade with the Native Americans they met in the New World. German immigrants certainly brought pretzels with them when they began settling in Pennsylvania around 1710. In 1861, Julius Sturgis founded one of the first commercial pretzel bakeries in the town of Lititz in Lancaster County, Pennsylvania.

Sturgis also claimed credit for developing the first hard pretzels—or at least, for being the first to intentionally bake hard pretzels (rather than leave the soft ones in the oven too long by accident). The crispy snacks lasted longer in an airtight container, allowing them to be sold further away from the bakery itself and to stay on shelves longer. Eventually, hard pretzels would come to be arguably even more popular than their soft counterparts.

Until the 1930s, pretzels were still manufactured by hand. But in 1935, the Reading Pretzel Machinery Company introduced the first automated pretzel maker, which enabled bakers to put out some 245 pretzels per minute, compared with the 40 per minute an individual worker could make by hand. Today, Pennsylvania remains the American pretzel-making capital, as a full 80 percent of U.S.-made pretzels come from the Keystone State.