The next time you have a margarita, raise your glass to the humble bat. Long-nosed bats are the main pollinators of agave, the plant used to make both tequila and mezcal. (Tequila is specifically made from blue agave, or Agave tequilana, while mezcal can be made from any species of the plant.) These agave plants open their flowers at night, attracting bats with their sugary nectar, and in turn, the bats help spread their pollen.

One of those bats, the lesser long-nosed bat, just got off the endangered species list in April 2018, as The Washington Post reported. It's the first bat species ever to recover its population enough to be taken off the Endangered Species List. Its revival is due, in part, to tequila producers along the bat's migration route between Mexico and the southwestern U.S. making their growing methods a little more bat-friendly.

While the relationship between bats and agave might be mutualistic, the one between bats and booze isn't necessarily so. Typical agave production for tequila and mezcal involves harvesting the plant right before it reaches sexual maturity—the flowering stage—because that's when its sugar content peaks, and because after the plant flowers, it dies. Instead of letting the plants reproduce naturally through pollination, farmers plant the clones that grow at the agave plant's base, known as hijuelos. That means fields of agave get razed before bats get the chance to feed off those plants. This method is bad for bats, but it's not great for agave, either; over time, it leads to inbred plants that have lower genetic diversity than their cross-pollinated cousins, ones that require more and more pesticides to keep them healthy.

Rodrigo Medellín, an ecologist who has been nicknamed the "Bat Man of Mexico," has been leading the crusade for bat-friendly tequila for decades, trying to convince tequila producers to let some of just 5 percent of their plants flower. The Tequila Interchange Project—a nonprofit organization made up of tequila producers, scientists, and tequila enthusiasts—led to the release of three bat-friendly agave liquors in the U.S. in 2016: two tequilas, Siembra Valles Ancestral and Tequila Ocho, and a mezcal, Don Mateo de la Sierra.

In 2017, when Medellín and his team visited the agave fields of Don Mateo de la Sierra to gather data, they discovered that the project was even more bat-friendly than they thought. The Mexican long-nosed bat, another endangered species, was also taking its meals at the field's flowering plants.

This weekend, raise a glass of tequila to all the bats out there—just make sure it's a bat-friendly brand.