It means there is a chance – albeit a slim one – of vegetable growers receiving a visit and a heavy fine from the police.

Gardeners say the caffeine in coffee keeps slugs out of the vegetable patch.

Many coffee shops let customers take the grounds home for free, which can then be used as a mulch or to improve compost.

But the Royal Horticultural Society (RHS) has warned that any gardener using coffee granules to deter slugs falls foul of EU regulations. The rules say that any active ingredient or chemical used in gardening must be explicitly approved and placed on an EU list of pesticides.

This aims to stop people using “home-made remedies in a dangerous manner”.

But caffeine has never been tested for its effectiveness as a pesticide, its impact on the environment, gardeners and other creatures.

This means its use as a slug deterrent is not allowed.

Dr Andrew Halstead, principal scientist of plant health at the RHS, said it was easier for the EU to list chemicals that had been tested and approved and impose a blanket ban on all other pesticides.

He said: “Anything that has not been through the system is illegal to use as a pesticide, however safe that chemical is perceived to be.

“If you were to use coffee grounds around plants with the intention of providing some organic matter in the form of a mulch, rather than as a slug control or deterrent, then the regulations relating to pesticides would not apply.

“This may all sound rather daft, but the intention of the pesticides legislation is to prevent people from applying untested dangerous chemicals.

“However, the chances of being prosecuted for scattering coffee grounds in a garden are, I suspect, remote.”

Bob Flowerdew, a panellist on Radio 4’s Gardeners’ Question Time and author of several gardening books, said: “Regulations are an ass, but they haven’t led to prosecutions. I cannot recommend that anyone breaks the law, but I can point out that, in other countries, people do use coffee grounds.”

Mr Flowerdew said some gardeners used soft soap on plants to kill aphids, although this would also be technically illegal.

“As long as you say. ‘I’m not killing the aphids, I’m giving them a wash, but oh dear they seem to have died accidentally’, it’s okay.

“It’s the British way: we work our way around the regulations.” - Daily Mail