MEDELLÍN, Colombia — Deep in the Andes mountains, the Cenicafe research institute is ground zero for an evolutionary and economic arms race to keep coffee flowing from Colombia into the cups of consumers across the world.

The stakes are high. Three major pests — two destructive fungi and one pest known as the coffee borer beetle — could wipe out the crops of the 500,000 family-run farms in Colombia that rely on coffee for their main income. The fact that the global coffee price is largely detached from Colombia’s production costs also threatens the viability of an industry that helps fill more than 1.6 billion cups around the globe every day.

Perched atop a hill outside Chinchina, Colombia, and dubbed by some in the industry as the NASA of coffee, Cenicafe is the hub for more than 60 researchers working to fend off the pests and disease that threaten the livelihood of area farms. They’re also investigating how farmers can use the climate, soil and specific insects in each coffee region to help produce the highest volumes of Arabica coffee. Once new varieties or techniques are developed, it’s up to their “Extension Service” to help local farmers incorporate that knowledge into growing coffee on their tiny plots of land, usually about 12 acres (less than five hectares).

Cenicafe’s focus on research to ensure the future of coffee, backed by an annual budget of $10.7 million (30.87 billion Colombian pesos), mostly from the country’s coffee industry, is unfortunately rare, according to Sylvain Charlebois, professor of food distribution and policy at Canada’s Dalhousie University.

“Globally, coffee is grown in areas where food science isn’t as developed or crop science isn’t as developed,” he said. The work is crucial, not only to battle disease and pests, but because there’s another threat complicating matters: “Everything that grows around the equator is more vulnerable because those regions are more vulnerable to climate change,” Charlebois added.

A worker inspects coffee beans in the process of being roasted at the Cafexcoop plant in the town of Sevilla, department of Valle del Cauca, Colombia, on Jan. 31, 2017. Juan Cristobal Cobo / Bloomberg via Getty Images file

Dr. Álvaro Gaitán, director of Cenicafe, said that for decades the center had been battling a fungus that causes coffee leaf rust, and the Broca (coffee berry borer beetle) a tiny insect that feeds on the coffee bean inside the berries. A third coffee pest, a fungus that spreads on rain drops and causes of coffee bud disease (CBD) has not yet arrived in the Americas, but plagues every coffee-producing country in central and East Africa.

When coffee leaf rust hit, Colombia’s production decreased by 31 percent on average from 2008-2011. But the country was able to replant with resistant varieties and avert the destruction of the entire country's crop, said Dr. Roberto Vélez, CEO of the Colombian Coffee Growers Federation.

“When it happened, we had 70 percent of the crop [that] was non-rust-resistant plantations. Now the proportion is the other way round,” he said.

Since Cenicafe began more than seven decades ago, one of its primary defenses has been to developing fungus- and parasite-resistant coffee plants. Its latest variety, for instance, Cenicafe 1, is resistant to both leaf rust and bud disease.

The plant represents 20 years worth of research. If it had not been deployed, it’s possible Colombia would not be growing coffee at all now: Sri Lanka, now most famous for its world-beating teas, was the capital of coffee in the mid-1800s, before the coffee rust wiped out the entire industry on the island.

According to Gaitán, the biggest threat now is coffee bud disease (CBD), which attacks cherries directly and causes large losses and is expensive to control with fungicide.

“Today Colombia already has in its plantations coffee trees with resistance to this disease, but in many countries they have no resistance to rust or CBD. If the CBD arrives in America (today it is only in Africa), and there are adverse conditions like [climate cycle] La Niña, the result can be devastating,” he said.

Another threat to the industry is that, as a commodity, the market price of unroasted beans is set in New York, meaning the price variations have more to do with U.S. monetary policy or market moves coming from industry titan Brazil, than with the costs of production in Colombia.

That means Colombia’s small farmers need to reduce expenses and maximize quality in any way they can to compete with the mass production techniques of Vietnam and Brazil. Teams of agronomic engineers from Cenicafe help farmers make decisions about planting, techniques, reducing water and pesticide use and so on by translating hard science into practical advice.

The low coffee price is something that concerns Pedro Echavarría, who runs and owns Pergamino, a Colombian specialty roaster, exporter and coffee shop based in Medellín.

“Roasters and farmers are working towards economic sustainability,” he said. “That’s the most important factor because without economic sustainability, there’s no environmental or social sustainability. If the farmers aren’t making a decent income, they can’t produce coffee.”

Charlebois said climate change was also likely to disrupt coffee markets in future, as rising temperatures lower quality and increase disruption of supply. On the flip-side, it could also bring coffee production to new regions like Canada. Gaitán said that looking to the future is vital.

“Because these new varieties take 20 years to develop,” he said, “the problems we have to think about are the ones that are going to be a threat to the next generation of coffee farmers."