It’s hard to imagine an American Thanksgiving table without the ubiquitous orange-crusted custard made from strained, spiced and twice-cooked squash.

Few of our festival foods can claim deeper American roots than pumpkins, which were first cultivated in Central America around 5,500 B.C. and were one of the earliest foods the first European explorers brought back from the New World. The orange gourds’ first mention in Europe dates to 1536, and within a few decades they were grown regularly in England, where they were called “pumpions,” after the French “pompon,” a reference to their rounded form.

Pumpkins, as the Americans grew to call them, quickly became part of England’s highly developed pie-making culture, which had for centuries been producing complex stuffed pastries in sweet and savory varieties. When the Pilgrims sailed for America on the Mayflower in 1620, it’s likely some of them were as familiar with pumpkins as the Wampanoag, who helped them survive their first year at Plymouth Colony, were. A year later, when the 50 surviving colonists were joined by a group of 90 Wampanoag for a three-day harvest celebration, it’s likely that pumpkin was on the table in some form. As useful as the orange squash were (especially as a way to make bread without much flour), they weren’t always popular. In 1654, Massachusetts ship captain Edward Johnson wrote that as New England prospered, people prepared “apples, pears, and quince tarts instead of their former Pumpkin Pies.”

What were these “former Pumpkin Pies” like? At the time, pumpkin pie existed in many forms, only a few of which would be familiar to us today. A 1653 French cookbook instructed chefs to boil the pumpkin in milk and strain it before putting it in a crust. English writer Hannah Woolley’s 1670 “Gentlewoman’s Companion” advocated a pie filled with alternating layers of pumpkin and apple, spiced rosemary, sweet marjoram and handful of thyme. Sometimes a crust was unnecessary; an early New England recipe involved filling a hollowed-out pumpkin with spiced, sweetened milk and cooking it directly in a fire (an English version of the same preparation had the pumpkin stuffed with sliced apples).

By the early 18th century pumpkin pie had earned a place at the table, as Thanksgiving became an important New England regional holiday. In 1705 the Connecticut town of Colchester famously postponed its Thanksgiving for a week because there wasn’t enough molasses available to make pumpkin pie. Amelia Simmons’ pioneering 1796 “American Cookery” contained a pair of pumpkin pie recipes, one of which similar to today’s custard version.

It wasn’t until the mid-19th century, though, that pumpkin pie rose to political significance in the United States as it was injected into the country’s tumultuous debate over slavery. Many of the staunchest abolitionists were from New England, and their favorite dessert soon found mention in novels, poems and broadsides. Sarah Josepha Hale, an abolitionist who worked for decades to have Thanksgiving proclaimed a national holiday, featured the pie in her 1827 anti-slavery novel “Northwood,” describing a Thanksgiving table laden with desserts of every name and description—“yet the pumpkin pie occupied the most distinguished niche.” In 1842 another abolitionist, Lydia Maria Child, wrote her famous poem about a New England Thanksgiving that began, “Over the river, and through the wood” and ended with a shout, “Hurra for the pumpkin pie!”

It’s no wonder that, when Abraham Lincoln made Thanksgiving a national holiday in 1863, observers in the Confederacy saw it as a move to impose Yankee traditions on the South. An editorialist in Richmond, Virginia, offered a sardonic explanation of the Yankee Thanksgiving: “This is an annual custom of that people, heretofore celebrated with devout oblations to themselves of pumpkin pie and roast turkey.”

After the Civil War, Thanksgiving—and with it, pumpkin pie—extended its national reach, bolstered by write-ups in women’s magazines like the one that Hale edited. In 1929 Libby’s meat-canning company of Chicago introduced a line of canned pumpkin that soon became a Thanksgiving fixture in its own right, replacing the need for roasting and straining one’s own squash. Next time you open a can, consider the past: the centuries of industrialists, editors, housewives, anti-slavery firebrands, culinary experimenters and Mesoamerican agriculturalists whose combined labors made your pumpkin pie possible.