Given avocado’s popularity today, it’s hard to believe that we came close to not having them in our supermarkets at all.

In my book “Avocado: A Global History,” I explain how the avocado survived a series of ecological and cultural close calls that could have easily relegated them to extinction or niche delicacy. Instead, the avocado persevered, prospered – and became one of the most Instagrammed foods in the world.

A ‘Ghost of Evolution’

Avocados are in the laurel family, the same group of plants that includes bay leaves and cinnamon. Laurel trees prosper in warm subtropical climates, and the avocado evolved in the warming climates of Central America during the Neogene period, roughly 10 million years ago.

During the Pleistocene era, which followed the Neogene, the biggest animals on Earth were what we call the megaherbivores – giant animals that subsisted almost entirely on a vegetarian diet. Most of these, like the giant ground sloth, would have dwarfed today’s largest megaherbivore, the African elephant. The giant herbivores of Pleistocene Mesoamerica like the gomphothere, the giant armadillo and the toxodon needed hundreds of pounds of food a day just to survive. Since food like leaves and grasses are so low in calories and fat, the animals prized any energy dense and fatty foods.

  • Bar Box 14-Piece Cocktail Shaker Set - Food Grade ...

    ₹11,995
    Buy Now
  • Indian Art Villa Pure Brass 7 Pieces Dinner Set/Th...

    ₹11,995
    Buy Now
  • The Indus Valley Pre-Seasoned Iron Tawa for Dosa/C...

    ₹714₹1,165
    39% off
    Buy Now
  • All Naturals 100% Pure Grapeseed Oil (100 ML)

    ₹599₹699
    14% off
    Buy Now

Enter: the avocado.

Megaherbivores didn’t peel the avocados and eat the green meat like we do today. Instead, their throats and digestive tracts were so large that they would simply swallow the avocado whole and excrete the undigested pit. In a process known as endozoochory, the pile of manure would serve as food for the next generation of avocado trees. As these giant animals roamed and grazed on avocados, they spread the fruit across what is now central Mexico.

But once the megaherbivores died off, the fruit was in a bind. The herbivores that were left had throats far too small to ingest a whole avocado seed, and dropping a giant seed at your own roots is a poor survival strategy for a tree; to thrive, it needs to disperse more broadly.

Avocados became what the botanist Connie Barlow calls a “Ghost of Evolution” – a species that should have gone extinct but was somehow able to survive. What the avocado had going for it was the lifespan of its trees, which survive much longer than most fruit trees. There are 100-year-old trees still producing fruit in California and 400-year-old trees in central Mexico.

By living so long and being so well adapted to their ecological niche, avocados were able to hold on until their next dispersers – Homo sapiens – came along.

More stops and starts

The earliest humans in Mesoamerica were quick to appreciate the virtues of the avocado. Groups like the Olmecs and the Maya started the first avocado orchards and began cultivating specimens that tasted the best and had the meatiest fruits, a process of trait selection that gave us the kinds of avocados we love today. Avocados were so important to the Maya that the 14th month of their calendar was named for them.

In the 1830s, Floridian Dr. Henry Perrine was introduced to avocados while serving as U.S. consul in Campeche, Mexico, and thought they would be an excellent addition to Florida’s horticultural offerings.

He sent some seeds to a friend on Indian Key in Florida who planted them. Not long after Perrine returned, the Second Seminole War broke out. Perrine and his family sought shelter from the fighting on the key, but he was killed during a raid on the island by one of the warring factions. The island was abandoned and the avocado trees were forgotten.

Hot and humid Florida had been hospitable to the avocado, but California has enough cold snaps in the winter months to make it difficult for most avocado varieties to thrive there. This could have been another dead end for the fruit, but early settlers in California took another stab at establishing them in the U.S. After a few failed attempts in the 1850s and 1860s, grower Judge R. B. Ord obtained a few cold-hardy specimens from central Mexico. A cold-tolerant variety was needed if California was to have a profitable avocado industry. Without it, the avocado might have remained a delicacy local to Mexico and its neighbours.

One of the earliest cold-hardy specimens was a variety given the name “Fuerte,” which means “strong” in Spanish. The Fuerte avocado earned its name because it was one of the few varieties that survived the famous “Freeze of ‘13,” a spell of cold weather that nearly ruined the nascent fruit industries of Southern California in the winter of 1913.

Until the 1940s, the Fuerte was the most popular avocado variety in America and made up about 75 percent of avocados sold.

The Hass comes to pass

The Fuerte has since been relegated to niche product, and represent only about 2 percent of the California market. Instead, the lion’s share of avocados sold today are the variety known as Hass, which rhymes with “pass.”

But were it not for a couple of kids with precocious palates, the world may never have tasted a Hass avocado, with the fruit remaining an odd delicacy for the well-to-do.

The Hass avocado is named for Rudolph Hass, a mailman who lived in La Habra, California. Originally from Milwaukee, Hass joined the thousands of Americans who went west to California in the 1920s and 1930s.

After reading a brochure about the money to be made in avocado ranching, he borrowed enough money to buy a small plot of land with Fuerte avocado trees on it. In the late 1920s, Hass bought some avocado seeds to grow rootstock for his budding nursery. One of these seeds grew a funny tree that rejected the Fuerte limbs that Hass wanted to graft onto it – a process that involves combining two tree plants with distinct characteristics. He was about to cut the misbehaving tree out, but his kids told him that these odd little avocados were their favorites, so he relented and kept the tree. After trying them himself, he thought they had marketing potential and began selling them to people at work and at a market in town.

Hass avocados slowly caught on, and in 1935 Hass patented the tree, the first patent awarded for a tree in America. But most growers, instead of buying his tree, evaded his patent and simply grafted their cuttings themselves. This practice was illegal, but enforcement in the 1930s was spotty.

Today, Americans eat 100 million pounds of avocados on Super Bowl Sunday, and Hass should have died a rich man. Instead, he never earned enough to quit the post office. It’s estimated that he only made about US$5,000 on the patent in his lifetime.

Jeffrey Miller is associate professor of Hospitality Management, Colorado State University. This piece originally appeared on The Conversation and has been republished here