The history of Coca-Cola is a history of drugs—and not just cocaine, the now-illegal substance that was infamously part of its recipe until 1904.

The late nineteenth century was a time when medicine hadn’t caught up with other fields, writes Mark Pendergrast in his history of the Coca-Cola company. That meant people turned to the massive industry of patent medicines, brewed concoctions marketed by people professing medical knowledge. But patent medicines, which could contain things as harmful as arsenic or as benign as vegetables, generally didn’t help. Coca-Cola was marketed as a patented medicine throughout its meteoric rise in popularity, he writes: "Far from being a unique beverage that sprang out of nowhere, Coca-Cola was a product of its time, place and culture."

In that culture, people overwhelmed by industrialization and urbanization as well as the holdover of the Civil War and other social changes struggled to gain purchase, turning to patent medicines for cures that doctors couldn't provide. Nineteenth-century people also struggled with things like addiction unaided—like John Stith Pemberton, the Georgia pharmacist who first brewed Coca-Cola syrup in his backyard on this night in 1886.

Pemberton was injured when he fought in the Civil War, writes historian Howard Markel, and like many others developed a morphine addiction during his search for relief. “Not surprisingly, he was intrigued by medical reports in the early 1880s that cocaine might be a cure for morphinism,” Markel writes.

Like many pharmacists of the period, Pemberton also made patent medicines, and he was always on the lookout for new recipes that would sell. He hit on Vin Mariani, a massively popular cocaine and wine beverage marketed by a Parisian chemist named Angelo Mariani.

Literary figures like Jules Verne were into it—but also religious leaders like Pope Leo XIII and Zadoc Khan, the chief rabbi of France, writes Jonathan Hamblin for The Atlantic. Why was it so popular? It actually made people feel great, and it was sold as medicine. Combining cocaine and alcohol produces another chemical more potent than what's normally found in cocaine, enhancing the high. Markel writes:

Ever the savvy medicinal magnate, Mariani extolled his product to the general public in solorful advertisements and pamphlets. “It nourishes, fortifies, refreshes, aids digestion, strengthens the system,” the advertisements declared; it is unequaled as a tonic, it is a stimulant for the fatigued and overworked body and brain, it prevents malaria, influenza and wasting diseases.”

Then in the 1880s, writes Hamblin, Pemberton brought the drink to America in the form of “Pemberton’s French Wine Coca.” The beverage might have been enjoyed in Atlanta the same way it was in Europe, but then in 1886, Fulton County in Atlanta went dry.

So Pemberton concocted a recipe using coca leaves, kola nuts and sugar syrup. “His new product debuted in 1886: ‘Coca-Cola: The temperance drink,’” writes Hamblin. He used similar marketing strategies to Mariani, and the new drink, originally sold at soda fountains (businesses that were often located in or near pharmacies), caught on with wealthy whites, he writes.

But rather than taking the cure-all approach as Mariani did, Pemberton really played up his drink's supposed mental benefits. One early advertisement that Hamblin links to describes the drink as an "intellectual beverage" as well as a non-alcoholic one. It contained "the valuable TONIC and NERVE STIMULANT properties of the Coca plant and Cola (or Kola) nuts," the ad reads, later describing the drink as "a valuable Brain Tonic, and a cure for all nervous affections."

This "brain tonic" angle is readily visible in early Coca-Cola advertisements and swag like mirrors, trays and even clocks, all of which have become collectors' items and Pinterest favorites.