This story appears in the February 2019 issue of National Geographic magazine.

Ketchup—that cheerful red sauce sold in handy glass bottles—first came on the American market in the 19th century. But its ingredients were shockingly different than they are today.

Food advocates complained that the sauce was frequently made from tomato scraps thickened with ground pumpkin rinds, apple pomace (the skin, pulp, seeds, and stems left after the fruit was pressed for juice), or cornstarch, and dyed a deceptive red. One French cookbook author described the ketchup sold in markets as “filthy, decomposed and putrid.”

By the late 19th century, it would become less putrid, as manufacturers added chemical preservatives to slow decomposition in the bottle. But the real change—the invention of modern ketchup—occurred in the 20th century, and it’s a story of both politics and personality. It begins with an unlikely alliance between one of the country’s richest food manufacturers, Henry J. Heinz, and an underpaid federal chemist. The two men bonded over a mutual belief that unsafe and untrustworthy food was a growing national problem.

Harvey Washington Wiley’s position on the matter surprised no one. As chief of the U.S. Department of Agriculture’s chemistry bureau, Wiley had been pushing for food safety standards since the 1880s. At that time, his tiny department was the only federal division responsible for the country’s food quality. His chemists had exposed both widespread fraud—from gypsum in flour to brick dust in cinnamon—and a dismayingly reckless use of untested preservatives, ranging from formaldehyde to borax.

Heinz’s stance was a shock, especially to his fellow industrialists. He refused to fall in line with other U.S. corporations, which were mostly moving to block any effort to establish food and drink standards. And to understand that, we need to take a look at the man himself as well as the successful businessman.

He was born in 1844 in Pittsburgh, the son of German immigrant parents. His parents, John and Anna Margaretha, were devout Lutherans; their children—Henry was the oldest of eight—were educated at a Lutheran school. Their mother insisted they live by Christian principles: “Do all the good you can. Do not live for yourself,” was one of her favorite sayings. It was also expected that the children would work hard and make a good living. That went without saying.

As a child Henry sold extra vegetables from the family’s kitchen garden to neighbors; by age 10 he had his own garden and carried produce by wagon to local grocers. By the time he was a teen, he was delivering produce to the grocers by horse cart and also selling prepared horseradish in small glass jars. Many commercial varieties were sold then in colored glass—sometimes for decorative purposes, sometimes because it obscured the contents. Young Heinz deliberately used clear glass so that customers could see the horseradish inside. By 1888, at age 44, he had his own food manufacturing business, the H.J. Heinz Company, and from there he never looked back.

Heinz’s company made some 60 products in 1896—and that would rise to 200 by the turn of the century. The company still offered horseradish but also pickles, ketchup, vinegars, chili sauces, tomato sauce, mincemeat, fruit butters, baked beans, preserved cherries, mustard dressings, currant jelly, pineapple preserves, an assortment of mustards, canned pastas. Heinz was a master promoter—the company used everything from lighted billboards to painted wagons to displays at World Fairs to advertise its products.

But Heinz also believed that for promotion to succeed, the product itself had to be good, the manufacturer trustworthy. He allowed public tours of his Pittsburgh factory so that people could admire its cleanliness and well-treated workers. He built greenhouses to experiment with the best varieties of fruits and vegetables. He continued to use clear glass, rather than colored, for his products. For his ketchup, he created one with an eight-sided base so customers could study the sauce from many angles.

And it was ketchup itself that would inspire him to go even further.

View Images ‘Poison’ Penned The Monkey Wars and her latest, The Poison Squad. Pulitzer Prize–winning journalist Deborah Blum is director of the Knight Science Journalism Program at MIT. Her books includeand her latest, Essay drawn from The Poison Squad by Deborah Blum, published by Penguin Press, an imprint of Penguin Publishing Group, a division of Penguin Random House, LLC. Copyright © 2018 by Deborah Blum.

As the story goes, ketchup began as an Asian sauce made of fermented fish. Some say it was invented in China in the sixth century and named ke-tsiap. Others say it came from Vietnam, and still others argue for a different beginning in the West Indies.

In other words, we don’t really know. What we do know is that the early tomato-based ketchups on U.S. shelves were rich environments for bacteria, mold, and other microbes—until bottlers began dosing the sauce with chemical preservatives.

Heinz, like other manufacturers, used chemical preservatives in his ketchup until the late 1800s. His original recipe, based on his mother’s, used salicylic acid derived from tree bark (some say slippery elm, others willow). Later he shifted to the newly popular preservative sodium benzoate, industrially made, cheap, tasteless, and effective. But as Wiley and other scientists began raising questions about the safety of the new preservatives, Heinz paid attention.

More than that, he set his company on a quest to be a leader in preservative-free products. He asked the company’s general manager—his cousin, Sebastian Mueller—to begin developing condiments that would need no chemical additives. Mueller warned him these would be costly to develop. Heinz had always offered a money-back guarantee, and the general manager also feared that a preservative-free ketchup would spoil easily, leading to costly returns.

But Heinz was not deterred. And Mueller became increasingly committed to the idea. A believer in scientific principles, he began to experiment with recipes for a homemade ketchup that would have a longer shelf life. He wanted a bacteria-killing acid concentration in the formula and so sought the right balance of vinegar and pectic acid, the latter occurring naturally in tomatoes. To get the acid levels right, Mueller discovered, he needed both high-quality tomatoes and high pulp content. Ketchups had traditionally been thin sauces of mixed content. To create its preservative-free ketchup, the company switched to a thicker, tomato-rich version—the foundation for the condiments of today.

This was not all altruism. The risks of preservatives were gaining wider public attention, thanks in part to the work of Wiley, who had begun testing them on human volunteers in 1902. The studies—nicknamed “the Poison Squad”—and the test subjects’ resulting ailments were front-page news across the country. Heinz was beginning to suspect that consumer distrust of the food supply would be far more expensive to manufacturers like him than the cost of improving the food itself.

His company started rolling out advertisements, publicly touting the purity of its products. And privately, Heinz made sure that major politicians, including President Theodore Roosevelt, were aware of his concerns. When food safety advocates met with Roosevelt in 1905 to urge legislation, Heinz representatives joined them.

The following year another food scandal roiled the industry. This was driven by the publication of Upton Sinclair’s novel The Jungle, packed with horrifying details about meat production in Chicago. By then the president, Congress, even a majority of manufacturers realized protection legislation was a necessity. In June 1906 the first two pieces of major consumer protection legislation in the United States—the Meat Inspection Act and the Pure Food and Drug Act—became law, laying the foundation for federal safety regulations.