If you landed in Bogota in the 1960s, one of the first things you would have probably seen outside the airport was a giant billboard. In a slightly menacing tone, it said: “Coffee rust is the enemy. Don’t bring plant materials from abroad”.

It was one of the first warnings about a foe that has been threatening Colombia’s coffee trade ever since.

Coffee rust is a disease with the power to cripple, or even wipe out, the country’s national product, the base of one of its biggest industries, and one of its most important sources of foreign currency. Last year alone, its coffee exports were worth $2.4bn (£1.8bn), and were 7.7% of all goods the country sold overseas. That makes Colombia the third largest producer of coffee in the world. In other words, if rust takes hold there and global supply dwindles, it will affect the price of the coffee we drink everywhere.

That’s why for the past few decades, Colombia’s scientists have been engaged in a little-known battle with the disease, staged from a small laboratory deep inside the mountains of Colombia’s coffee axis.

The question is, can Colombian coffee’s distinct flavours survive intact?

Coffee rust has plagued farmers for more than a century. When a tree gets infected by it, its leaves produce a brown, thin powder when scratched, pretty much like iron rust. The disease, caused by the fungus Hemileia vastatrix, also de-colours the bush’s leaves from a bright green to a brownish yellow. In the end, the tree loses all its leaves, as well as its ability to produce beans.

If left unattended, the disease can have dramatic consequences. In the late 19th Century, Sri Lanka, the Philippines, and other countries in Southeast Asia were the major exporters of coffee in the world. In a matter of decades, the disease meant they practically stopped growing it.

Historians suggest that this is part of the reason why Britons prefer tea nowadays. “Sri Lanka moved over to tea production” since coffee was no longer profitable, explains Aaron Davis, head of coffee research at Royal Botanic Gardens, Kew. Luckily for Asian producers, Britain was eager to switch its taste when their coffee supply vanished.

Beauty vs beast

What makes coffee rust a particular worry for Colombia is that it attacks the type of coffee that the country relies on – and that coffee lovers have got used to drinking.

Coffee comes in two varieties. We could call them ‘the beauty’ and ‘the beast’.

‘The beauty’ is Coffea arabica. Its seed gives a delicious and delicate brew that sells at good prices in international markets. This is the variety that made Colombian coffee so famous.

‘The beast’ is Coffea canephora, also known as robusta. It is a tougher tree, with more resistant leaves, that is cheaper to grow and crop. It has a more rough and bitter taste; not very appealing for coffee connoisseurs and not as appreciated by the market as its gentler brother. As a result, it accounts only for a 37% of the world coffee production, according to the International Coffee Organisation.

Unfortunately, coffee rust attacks the ‘beauty’, but not the ‘beast’. Colombia only exports ‘beauties’, so switching has never been an option.

In the 1960s, a team of scientists at a research laboratory called Cenicafe set out to find a solution that drew on the best features of the two varieties – but it wouldn’t be straightforward.

The laboratory

To get to Cenicafe, you have to drive all the way to the top of a mountain; the twisting roads can make you sick if you are not used to them. The lab is nested there to keep its 89-year-worth body of research away from the force of nature: the prior building flooded after a volcano eruption in 1985.

It was set up by the Colombia’s National Federation of Coffee Growers (also known as Fedecafe), the coffee industry association in the country, and is considered a global flagship centre for the science of coffee.

“Cenicafe is what has allowed us to remain competitive and lower our risk”, explains Hernando Duque, technical director of Fedecafe. Its research helped domesticate and make viable many of the high-quality varieties that the country grows and the world enjoys.

Today, the laboratory’s work is regarded as the gold standard in the fight against “the most acute threat against coffee in the Americas”, says Michael Sheridan, director of sourcing and shared value at Intelligentsia Coffee Roasters, a specialty coffee importer in the US.

To save Colombia’s coffee, Cenicafe scientists in the 1960s realised that they needed to breed new varieties that could inherit both the distinctive taste and aroma of Colombian ‘beauty’, and the resistance genes of the ‘beast’.

To do so, they had to get those genes somewhere: ‘the beauty’ and ‘the beast’ don’t usually interbreed.

The solution, they found, would come from the other side of the world.

From Timor with love

At some point in recent history, something weird happened in Timor. Somewhere in this small island on the Indian Ocean, halfway between Indonesia and Australia, the ‘beauty’ and the ‘beast’ had an affair of sorts. As a result, the Timor hybrid was born.

The ‘beauty’ and the ‘beast’ had an affair of sorts. As a result, the Timor hybrid was born  

This naturally occurring hybrid of arabica and robusta was found in 1927, and started to be harvested in 1940. It is not really a great tasting berry, but it had a crucial feature: unlike normal robusta, it can be bred again with arabica varieties, which means that it can transmit its rust resistance to them.

Coffee research centres around the world started to do just that, but there was a problem. The result did not taste very good, which meant that it was going to fail. If cultivators were not going to be paid at least as much money for the new varieties, they simply were not going to change their bushes.

Cenicafe begun its efforts to combat rust begun in 1968, knowing that rust from overseas would arrive in Colombia soon. It started a project to created cultivars of the bush that resist it. It was not just a matter of putting two varieties in a genetic blender. The real work was to interbreed five generations of trees, and select those that provided a better taste and more delicate aroma, as well as a shorter tree, good productivity for growers and resistant to different races of the Hemileia fungus.

In 1980, the centre released its first hybrid of Caturra – the dominant variety grown in the country – and the Timor hybrid. It was called Colombia, and it was good enough for it to be well accepted by growers and buyers, to the point that it still is around in many of the country’s coffee farms.

It was just in time. Three years later, coffee rust was first identified in Colombia.

A moving target

Achieving the Colombia variety was not going to be the end of the war against rust. Hemileia vastatrix has since evolved, and found a way to infest some of the formerly immune coffee bushes. While it maintains partial resistance, the fungus will inevitably break it.

There’s also the menace of climate change. Temperatures in the coldest part of the year are rising, which some scientists believe reduces the time the rust fungus takes to attack the leaves once it gets to the tree. As a result, future epidemics might be longer and more destructive.

With that in mind, Cenicafe has developed other varieties. In 2005, they released a new seed, called Castillo after Jaime Castillo Zapata, the lead scientist behind the development of Colombia. And in 2016, a third variety, named Cenicafe 1, also increased its resistance to other diseases.

The main idea is to make it more difficult for the fungus to fully break the tree’s resistance. This is achieved by including many different genes that offer invulnerability against the pathogen. If one of them is defeated by a new mutation of Hemielia, there are many others left.

By increasing the gene pool, coffee scientists also aim at protecting the crops from other risks. “If you reduced genetic diversity, you have less resistance to climate, pests and diseases,” explains Davis.

Lack of diversity has proven disastrous to other commercial crops. Almost all bananas you can buy today in most parts of the world are clones from a single parent plant called Cavendish, initially bred in Britain in the 19th Century.

It was not the tastiest fruit, but it was resistant to the fungus that wiped out the world’s most popular variety in the mid-20th Century, the Gros Michel. The fungus mutated and now it can kill Cavendish, which means that the extinction of the banana as most of the world knows it is on the cards.

Coffee scientists have heard the cautionary tale. In the distant future when rust finally defeats Castillo and Colombia, hopefully other varieties will keep up the fight.

Beyond the seeds

If rust takes hold, there will also be human costs. Colombia’s coffee industry employs around 730,000 people, most of them on the deprived rural areas of the country.

Intelligentsia’s Sheridan spent many years deep inside Colombia as a development worker. He saw how small coffee farmers gamble everything to get a good yield. They take very high risks, and if something goes wrong, their families pay a hefty toll.

Castillo is not a matter of luxury. It is a matter of necessity  

That is why he believes varieties like Castillo made coffee viable for many small farmers, who now have a reasonably priced and less risky option. “It is not a matter of luxury. It is a matter of necessity,” he says.

The seed is only part of this story though. Getting growers to change to resistant varieties can be difficult. A single coffee bush can bear fruit at peak productivity for up to eight years, which means that most new seeds are not immediately adopted by cultivators once they are released.

Also, many growers have an emotional attachment to the varieties they already grow. They know the quirks of their trees, their ebbs and flows, and the precise ways they behave in the particular environments of their farms. Even when Castillo is grown in very similar way to Caturra, for some farmers planting a new seed can feel like hosting a stranger in your house.

The change also has a monetary cost. As a team of Latin American coffee researchers wrote in a recent paper about the rust epidemic, variety replacement requires a large initial investment, and returns “no or very low yields for at least the first two years, and thus a greatly reduced income”.

Colombia has put forward a strategy for overcoming these hurdles. Fedecafe offers subsidies and loans to farmers for helping them buy resistant seeds, and technical advice on growing.

Still, the disease can wreak havoc on the industry. A 2008 outbreak still managed to wipe out up a quarter of the year’s crop in Colombia. Since then, the country has accelerated its efforts to make farmers grow Castillo.

Today, per Fedecafe’s figures, 76% of all coffee trees in Colombia are at least partially resistant to coffee rust, an increase achieved mostly by pushing Castillo among growers. And while other countries have seen their crops halved in recent outbreaks, Colombia maintains a single-digit prevalence of the disease.

This is why most people in the coffee world, from growers to scientists to buyers, regard Colombian efforts as the best in the world in the fight against rust. But not all of them – the taste of the new varieties has not been universally embraced.

Key numbers

Once a year, in front of a panel of cuppers (the expert tasters of this industry), coffee farmers put all their hard work on the line. Their goal is to reach a magic number: 80.

Tasters rate a coffee’s flavour with a score out of 100 – assessing fragrance, body, sweetness and more. A rating of 80 is the minimum to be considered “specialty”, and therefore sold at higher prices than the market average. Some buyers are even pickier: they demand an 83, or even an 87. Of course, they pay due premiums for the extra quality.

The coffee farmers’ goal is to reach a score of 80 for flavour

Beyond that, it’s the confirmation of the growers’ mastery in their craft, the score that puts them among the elite of coffee producers.

“It is very difficult to get there,” says Mauricio Castaneda, the eldest son of a family of coffee farmers. “You have to take care of a lot of small details.” In 2016, only 17% of the coffee exported by Colombia reached that mark.

Some people in the coffee market think that Castillo just doesn’t get that high. For years, some coffee cuppers have complained about the slightly lower quality and cup profile of Castillo over Caturra – a claim that could sink the viability of the resistant variety.

It has been a contentious issue inside the coffee community. For instance, for Alejandro Cadena, CEO of Caravela, a coffee trade company, “Castillo is not the most suitable variety for specialised, high quality markets.” He says that sometimes it can have some rubber notes in it, particularly when something was not done right in its process.

This keeps it away from the more high-priced, high-quality market, Cadena contends. “But for more commercial, high-volume, Castillo is an outstanding variety.”

Some others, like Sheridan, say that this is not really the case. He backs up his claims on a study he performed in the 2014 crop in Nariño, one of Colombia’s coffee growing states, where expert cuppers blind tested both varieties and did not find any significant difference.

While he is cautious to assert that this research cannot be extrapolated to other regions of Colombia and to other years’ crops, he claims that the market is giving many signs of appreciation for Castillo. Top baristas choose it in competitions, and it has a lot of prestige among international buyers. “It’s increasingly difficult in Colombia, when sourcing small holders’ coffee, to find batches that do not have some Castillo in them,” he says.

Top baristas choose Castillo in competitions  

Castillo is also near Eduardo Florez’s heart. He is a Colombian entrepreneur who has a stall in the Borough Market in London, where he sells the coffee he roasts in his garage in Brighton. He sources small batches for his business, and has found some very special Castillos. “Once I saw one that had peach notes”, he points out, excited. “Imagine how delicate is that!”

At Florez’s garage, I decided to do my own (non-expert and non-representative) blind cupping. I tasted four samples at Florez’s garage without knowing the variety of each one.

One of them was complex and worth sipping many times: its fruit-like acidity and sweetness were in a dance of sorts, where each flavour did not cancel but complement and enhance each other. Another one, well, tasted like the office ‘joe’: the sort of brew you drink just to keep going. The other two were somewhere between the good one and the plain one.  

But the one I liked the most? The one with the fruity flavours and sweetness? It was a Castillo.

Jose Luis Penarredonda is a writer for BBC Future, he tweets at @noalsilencio.  

Join 800,000+ Future fans by liking us on Facebook, or follow us on Twitter.

If you liked this story, sign up for the weekly bbc.com features newsletter, called “If You Only Read 6 Things This Week”. A handpicked selection of stories from BBC Future, Culture, Capital, and Travel, delivered to your inbox every Friday.