In the 17th century, clergy believed that it was the "bitter invention of satan".

Globally we get through around 2 billion cups a day but the health effects of coffee are still widely debated

In the 20th century coffee was blamed for high blood pressure and heart attacks and more recently the caffeine contained in the drink has been linked to a risking epidemic of poor sleep.

Professor Tim Spector, a British epidemiologist and science writer, said he was brought up through medical school to warn people off coffee.

"That it was a stimulant that over-excited your heart and was probably a cause of heart attacks.

HeraldScotland:

"It was also linked to cancer and other things in the 1980s. I even wrote a paper on it myself that coffee caused cancer of the pancreas. It was maybe good for my career but was total rubbish."

He said it was only over the past five years that the evidence was now "incontrovertible" that coffee drinkers have less heart disease than non-coffee drinkers.

"If you go for the good quality ones you are much more likely to have a healthy outcome.

"There is no excess in cancer to show there are any bad effects," he added.

"For most people it is a health drink, for those who tolerate it well."

However, he said there was always a caveat to this in that some people might be more sensitive to the effects of caffeine.

He said people who drink three or four cups a day were getting "considerable amounts of fibre". One cup contains more than a glass of fresh orange juice.

HeraldScotland:

He said studies had shown that micronutrients that naturally occur in coffee called polyphenols have a protective effect on the heart.

"High concentrations are like rocket fuel for your gut microbes and produce these benefits.

"We don't still understand why that happens," he said.

He said the data showed that between one and five cups a day was healthy, "but as soon as you get to six or more you seem to lose that benefit and we don't really understand why.

"Like anything that has chemicals and mildly addictive properties there might be a sweet spot."

He said the same cup of coffee would have different effects on every body and cheaper coffee contains more caffeine than an espresso while women are more sensitive to it and smokers need to drink more to "get the same hit".

"On top of that you have this enormous genetic difference between people, like alcohol so everyone has to do their own experiments and try using decaffeinated coffee instead."

He said there was some indication that decaff coffee is "nearly as healthy" as the regular sort if it is good quality.

"Most of the studies lack the big numbers but most of the data pointing to decaff having some health properties as well.

Professor Tim Spector hosts the ZOE Science & Nutrition podcast.